const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.split('\n');
const line1st = lines[0].split(' ');
const line2nd = lines[1].split(' ');
const N = +line1st[0];
const M = +line1st[1];
const A = line2nd;

// console.log(`N=${N}`);
// console.log(`M=${M}`);
// console.log(`A=`);
// console.log(A);

const sum = A.reduce((sum, now) => (+sum) + (+now), 0);
// console.log(sum);

const ans = N - sum;

if (ans < 0) {
    console.log(-1);
} else {
    console.log(ans);
}
