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

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

}

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