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