function main(N, S) {
  var holiday = N.split(" ").map(n => parseInt(n));
  var totalHomework = S.split(" ").map(x=> parseInt(x));
  
  if(!holiday || !totalHomework.length) {
    return -1
  }
  var days = totalHomework.reduce((a,b) => a + b,0);

  if(days > holiday[0]) {
    console.log(-1);
  }
  
  console.log(holiday[0] - days);
}
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
 
main(input[0], input[1]);