#include <bits/stdc++.h>

using namespace std;

int main(void) {
  long long N, M;
  cin >> N >> M;

  long long count = 0;

  vector<int> A(M);
  for(int i=0; i<M; i++) {
    cin >> A.at(i);
    count += A.at(i);
  }

  if (count > N) { cout << -1 << endl; } else {
    cout << N - count << endl;
  }


  
}
