-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.List (unfoldr)
import qualified Data.ByteString.Char8 as BS

main = do
  [n,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  xs <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let a = n - sum xs
  if a < 0 then
    putStrLn "-1"
  else
    print a
