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