const Main = input => {
  const sp = input.split('\n');
  const sp0 = sp[0].split(' ').map(e => Number(e));
  const N = sp0[0];
  const M = sp0[1];
  const A_list = sp[1].split(' ').map(e => Number(e));

  let sum = 0;
  for(let A of A_list) sum += A;
  const rest = N - sum;
  const result = rest > -1 ? rest : -1;
  console.log(result);
};

Main(require('fs').readFileSync('/dev/stdin'. 'utf8'));
/*Main(`41 2
5 6`)
Main(`10 2
5 6`)
Main(`11 2
5 6`)
Main(`314 15
9 26 5 35 8 9 79 3 23 8 46 2 6 43 3`)*/
