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