#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(int argc, const char *argv[]) {
  int N, M;
  long res;
  cin >> N >> M;
  vector<int> A(M);

  for (int i = 0; i < M; i++) {
    cin >> A[i];
  }

  res = N - accumulate(A.begin(), A.end(), 0);
  if(N < 0){
    cout << "-1" << endl;
  }else{
    cout << res << endl;
  }

  return 0;
}
