#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a, total;
  for (int i = 0; i < (int)(m); i++) {
    cin >> a;
    total += a;
  }
  if (n < total)
    cout << "-1" << endl;
  else
    cout << n - total << endl;
  return 0;
}
