#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
void solve() {
  ll n, m;
  cin >> n >> m;
  ll sum = 0;
  for (ll i = 0; i < m; ++i) {
    ll x;
    cin >> x;
    sum += x;
  }
  ll ans = n - sum;
  if (ans < 0)
    cout << -1 << "\n";
  else
    cout << ans << "\n";
}
int main() {
  solve();
  return 0;
}
