function Main(input) {
    var tmp = input.split("\n");
    var first = tmp[0].split(" ");
    var A = tmp[1].split(" ");

    var N = parseInt(first[0],10);
    var M = parseInt(first[1],10);

    var sum =0;

    for(var i=0;i<A.length;i++){
        sum = sum + parseInt(A[i],10);
    }

    //console.log(N+"日間夏休み");
    //console.log(M+"個の宿題");
    //console.log(A);
    //console.log(sum);

   
    if(sum <= N){
        console.log(N-sum);
    }else{
        console.log(-1);
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
