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

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

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

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