#include <bits/stdc++.h>
const int maxn = 5e5 + 10;
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  long long n, m, x, sum = 0;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x;
    sum += x;
  }
  if (sum <= n)
    cout << n - sum;
  else
    cout << "-1";
}
