function Main(input){
    input = input.split("\n");
    var mem = input[0].split(" ").map(Number);
    var arr = input[1].split(" ").map(Number);
    var sum = 0;
    for(var i=0;i<arr.length;i++){
        sum += arr[i];
    }
    console.log(sum>mem[0]?"-1":mem[0]-sum);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());