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