#include <bits/stdc++.h>
int main() {
  int N, M;
  std::cin >> N >> M;
  int A[M];
  int cost = 0;
  for (auto &a : A) {
    std::cin >> a;
    cost += a;
  }
  std::cout << (N < cost ? -1 : N - cost) << "\n";
}
