function Main(input) { var data = input.split("\n"); var line = data[0].split(" ") var K = +line[0]; var N = +line[1]; var F = +line[2]; var A = data[1].map(Number); rapt(K, N, F, A); } function rapt(K, N, F, A) { var ageSum = 0; var totalK = K * N; for (var i = 1; i <= F; i++) { ageSum += A[i-1] } if (totalK >= ageSum) { console.log(totalK - ageSum); } else { console.log(-1) } } Main(require("fs").readFileSync("/dev/stdin", "utf8"));