'use strict';
function main(input) {
  const a = input.trim().split("\n")[0].split(" ");
  const b = input.trim().split("\n")[0].split(" ");
  let sum;
  
  for (let i = 0; i < b/length; i ++) {
    sum += b[i];
  }

  if (a[0] >= sum) {
    console.log(a - sum);
  } else {
    console.log(-1);
  }

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));