let NM = readLine()!.split(separator: " ").map { Int($0)! }
let N = NM[0], M = NM[1]
let A = readLine()!.split(separator: " ").map { Int($0)! }
let sum = A.reduce(0) { $0 + $1 }
if N - sum < 0 {
  print(-1)
} else {
  print(N - sum)
}