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