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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  rep(i, m) cin >> a[i];

  int total = 0;
  rep(i, m) total += a[i];

  int ans = 0;
  if (total > n) {
    ans = -1;
  } else {
    ans = n - total;
  }

  cout << ans << endl;

  return 0;
}
