#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int summer_vacation_days, homework_num;
  cin >> summer_vacation_days >> homework_num;
  int homework_day;
  int total_homework_day = 0;
  for (int i = 0; i < homework_num; i++) {
    cin >> homework_day;
    total_homework_day += homework_day;
  }
  if (total_homework_day > summer_vacation_days) {
    cout << -1 << endl;
  } else {
    cout << (summer_vacation_days - total_homework_day) << endl;
  }
  return 0;
}
