'use strict';
function main(input) {
  input = input.split("\n");
  const a = parseInt(input[0], 10).split(" ");
  const b = parseInt(input[1], 10).split(" ");
  let sum;

  for (let i = 0; i < b.length; i ++) {
    sum += b[i];
  }

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

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