#include <bits/stdc++.h>
using namespace std;
int main() {
  long int N, M, t = 0, a;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> a;
    t += a;
  }
  if (t > N)
    cout << -1;
  else
    cout << N - t;
}
