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