#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const double pi = acos(-1);
const int N = 1e4 + 10;
int a[N], n, m;
void solve() {
  cin >> m >> n;
  int sum = 0;
  for (int i = 1; i <= (n); ++i) {
    cin >> a[i];
    sum += a[i];
  }
  int ans = m - sum;
  ans = max(-1, ans);
  cout << ans << endl;
}
int main() { solve(); }
