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