#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int sum = 0;
  for (int i = 0; i < b; i++) {
    int c;
    cin >> c;
    sum += c;
  }
  if (a >= sum)
    cout << a - sum;
  else
    cout << -1;
}
