import Control.Applicative import Text.Printf main = do [k,n,f] <- fmap (read :: String -> Int) . words <$> getLine xs <- fmap (read :: String -> Int) . words <$> getLine printf "%d\n" $ solve (k*n) xs solve rest [] = rest solve rest (x:xs) = if rest < x then -1 else solve (rest-x) xs