let input = readLine()!.split(separator: " ").map { Int($0)! }

let N = input[0]
let M = input[1]

let A = readLine()!.split(separator: " ").map { Int($0)! }

let result = N - A.reduce(0, +)
print(result >= 0 ? result : -1)
