#include <bits/stdc++.h>
using namespace std;
using p = pair<int, int>;
using P = pair<long long, long long>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<long long>;
using VVL = vector<vector<long long>>;
using VVVL = vector<vector<vector<long long>>>;
using Graph = VV;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  V a(m);
  long long sum = 0;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum > n)
    cout << -1 << endl;
  else
    cout << n - sum << endl;
}
