const fs = require("fs")
const input = fs.readFileSync("/dev/stdin", "utf-8")
const arr = input.split("\n")[0].split(" ")
const N = parseInt(arr[0])
const M = parseInt(arr[1])
const A = input.split("\n")[1].split(" ").map(function(i) {
  return parseInt(i)
})

function homework(a) {
  let result = 0
  a.forEach(function(i) {
    result += i
  })
  return result
}

function fun(n, a) {
  let result = n - homework(a)
  if (result < 0) {
    return -1
  }
  return result
}
console.log(fun(N, A))
