#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, M, temp, sum = 0;

  cin >> N >> M;

  for (int i = 0; i < M; i++) {
    cin >> temp;
    sum += temp;
  }

  if (N >= sum) {
    cout << N - sum << endl;
  } else {
    cout << -1 << endl;
  }
}