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

let n = nm[0]
let m = nm[1]

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

var c = 0

for number in a {
  c += number
}

let answer = n - c

if answer < 0 {
  print(-1)
} else {
  print(answer)
}
