#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int sum = 0;
  int x;
  int i = 0;
  while (i < M) {
    cin >> x;
    sum += x;
    i++;
  }
  if (N - sum >= 0) {
    cout << N - x << endl;
  } else {
    cout << -1 << endl;
  }
}
