#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[m];
  long int sum = 0;
  for (int i = 0; i < m; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  if (sum > n)
    cout << "-1\n";
  else
    cout << n - sum << "\n";
}
