#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int mpow(int a, int b) {
  if (b & 1) return a * mpow(a, b - 1);
  return mpow(a * a, b >> 1);
}
int mpow(int a, int b, int m) {
  if (b & 1) return a * mpow(a, b - 1, m) % m;
  return mpow(a * a % m, b >> 1, m) % m;
}
vector<int> graph;
void dfs(int cur, int prev = -1) {
  for (auto& i : graph) {
    if (i == prev) continue;
    dfs(i, cur);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, m;
  cin >> n >> m;
  ll s = 0;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    s += x;
  }
  if (n - s < 0)
    cout << -1;
  else
    cout << n - s;
  return 0;
}
