main = do
  str <- getLine
  let [n, m] = map read (words str) ::[Int]
  str <- getLine
  let as = take m $ map read (words str) ::[Int]
  
  let sub = n - sum as
  
  print $ if sub >= 0 then sub else -1
  