{-# LANGUAGE PartialTypeSignatures #-}
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import qualified Data.Char as C
import qualified Data.List as L

main :: IO ()
main = do
  [n,m] <- readInts
  readInts >>= output . solve n

solve :: Int -> [Int] -> _
solve n xs
  | s > n = -1
  | otherwise = n-s
  where
    s = sum xs

output :: _ -> IO ()
output = print

-- utils
readInts :: IO [Int]
readInts = L.unfoldr (C8.readInt . C8.dropWhile C.isSpace) <$> C8.getLine