"use strict";

const main = (input) => {
    const spi = input.split('\n');
    const [n, m] = spi[0].split(' ').map(e => Number(e));
    const a = spi[1].split(' ').map(e => Number(e));

    const sum = a.reduce((x, y) => x += y);

    if (n - sum < 0) console.log(-1);
    else console.log(n - sum);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
