import Foundation

let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ") //ブランクで区切られている場合

let n: Int = Int(split[0])!
let m: Int = Int(split[1])!

let input_line2: String = readLine()!
let split2: [String] = input_line2.components(separatedBy: " ") //ブランクで区切られている場合
var array: [Int] = []

for a in split2 {
    array.append(Int(a)!)
}

var ans = 0


var all = 0
for c in array {
    all += c
}

if all > n {
    ans = -1
} else {
    ans = n - all
}

print(ans)