#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
int main() {
  int N, M, W = 0;
  cin >> N >> M;
  int A[11000];
  for (int i = 0; i < (int)M; i++) {
    cin >> A[i];
    W += A[i];
  }
  if (N >= W) {
    cout << N - W << endl;
  } else {
    cout << -1 << endl;
  }
}
