let s = readLine()!
let t = s.split(separator: " ")
let N = Int(t[0])!
let M = Int(t[1])!
let u = readLine()!

var array:[Int] = []
var sum = 0
for i in 0..<M {
    let v = u.split(separator: " ")
    sum += Int(v[i])!
    
}

if N >= sum {
    print("\(N-sum)")
} else {
    print("-1")
}