function main(input) {
    var inputs = input.split("\n");
    var tmp = inputs[1].split(" ");
    const kikan = parseInt(inputs[0][0], 10);
    let amari = 0;
    let ptmp = tmp.map(function (tmpitem) {
        return parseInt(tmpitem, 10);
    });
    ptmp.forEach(function (ikko) {
        amari = amari + ikko;
    });
    const kekka = kikan - amari;
    if (kekka < 0) {
        console.log(-1);
    } else {
        console.log(kekka);
    }
}

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