#include <bits/stdc++.h>

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;
const ll INF = (1LL << 62);

int main() {
  // std::cout << std::fixed << std::setprecision(10);

  ll N, M;
  scanf("%lld %lld", &N, &M);

  ll sum = 0;

  for (ll i = 0; i < M; i++) {
    ll v;
    scanf("%lld", &v);
    sum += v;
  }

  if (sum > N) {
    cout << -1 << endl;
  } else {
    cout << (N - sum) << endl;
  }
}
