const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});
let lines = [];
reader.on("line", line => {
  lines.push(line);
});
reader.on("close", () => {
  const linesNum1 = lines[0].split(' ');
  const linesNum2 = lines[1].split(' ');
  const summerTime1 = linesNum1.map(str =>{ return Number(str) });
  const summerTime2 = linesNum2.map(str =>{ return Number(str) });
  let homeWork = summerTime2.reduce((a,x) => a += x);
  if(summerTime1[0] >= homeWork){
    console.log(summerTime1[0] - homeWork)
  } else {
    console.log('-1')
  }
});