#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int m;
  cin >> n;
  cin >> m;
  int a[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  int j = 0;
  int b = 0;
  while (j < m) {
    b = b + a[j];
    j = j + 1;
  }
  if (n - b < 0) {
    cout << -1 << endl;
  } else {
    cout << n - b << endl;
  }
}
