#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setiosflags(ios::fixed) << setprecision(12);
  long long n, m;
  cin >> n >> m;
  vector<int> a(n + 1);
  long long sum = 0;
  for (int i = 1; i <= m; i++) {
    long long t;
    cin >> t;
    sum += t;
  }
  if (n >= sum)
    cout << n - sum << "\n";
  else
    cout << -1 << "\n";
  return 0;
}
