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