#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
using VPI = vector<pair<int, int>>;
using LL = long long;
int main() {
  int n, m;
  cin >> n >> m;
  VI a(m);
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 0; i < m; i++) n -= a[i];
  if (n < 0)
    cout << "-1";
  else
    cout << n;
}
