#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep2(i, i0, n) for (int i = i0; i < n; ++i)

int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  rep(i, m) {
    int ai;
    cin >> ai;
    sum += ai;
  }

  cout << (sum > n ? -1 : n - sum) << endl;
  return 0;
}