process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var tmp = lines[0].split(' ');
 var n = Number(tmp[0]);
 var m = Number(tmp[1]);
 var day = lines[1].split(' ');
 for(i=0; i<m; i++){
   n -= Number(day[i]);
 }

 if(n < 0){
   console.log("-1");
 }

 console.log(n);
});