#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> A(m);
  for(int& a : A)
    cin >> a;
  int play = accumulate(A.begin(), A.end(), -n);
  cout << ((play > 0) ? -1 : -play) << "\n";
  return 0;
}
