function Main(input) {
  const arr = input.split('\n');
  const n = arr[0].split(' ')[0];
  const h = arr[1].split(' ').map(x => Number(x));
  const sum = h.reduce((acc, curr) => acc + curr);

  if (sum > n) {
    console.log('-1');
  } else {
    console.log(n - sum);
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));