function Main (input) {
  input = input.split("\n").map(inp => inp.split(" ").map(Number));
  var N = input[0][0];
  var A = input[1];
  for (var i of A) {
    N -= i;
  }
  console.log(N < 0 ? -1 : N);
}

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