#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long int inf = long long int(1e18);
const double PI = acos(-1);
long long int modexp(long long int x, long long int n, int md) {
  if (n == 0) return 1;
  if (n % 2 == 0) return modexp((x * x) % md, n / 2, md);
  return (x * modexp((x * x) % md, n / 2, md)) % md;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m, s = 0;
  cin >> n >> m;
  vector<long long int> a(m);
  for (int i = 0; i < m; ++i) {
    cin >> a[i];
    s += a[i];
  }
  if (s > n)
    cout << -1 << "\n";
  else
    cout << n - s << "\n";
}
