{-# LANGUAGE TypeApplications #-}
import qualified Data.ByteString.Char8 as BS

check :: Int -> [Int] -> Int
check n list =
  if n >= sum
  then n - sum
  else -1
  where
    sum = foldr (+) 0 list

main :: IO()
main = do  
  [n,m] <- map (read @Int . BS.unpack) . BS.words <$> BS.getLine
  as <- map (read @Int . BS.unpack) . BS.words <$> BS.getLine
  print $ check n as