import Foundation
var str = readLine()!.components(separatedBy:" ")
var n = Int(str[0])!
var m = Int(str[1])!
var l = readLine()!.components(separatedBy:" ")
var a = [Int]()
for aa in l {
  a.append(Int(aa)!)
}
let sum = a.reduce(0) { $0 + $1 }
if n-sum<0{
  print(-1)
} else {
  print(n-sum)
}