"use strict";
function main(input) {
  let n=0;
  let m=0;
  [n, m] = input[0].trim().split(" ").map(i => parseInt(i));
  const a = input[1].trim().split(" ").map(i => parseInt(i));

  let total = 0;
  for(let i=0;i<m;i++){
    total += a[i];
  }
  
  console.log(((n-total)<0)?-1:(n-total));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));