#include <bits/stdc++.h>
using namespace std;
long int N, M;
const long int MAX_M = 10 ^ 4;
long int A[MAX_M];
int main() {
  cin >> N >> M;
  for (long int i = 0; i < M; i++) {
    cin >> A[i];
  }
  long int sum = 0;
  for (long int i = 0; i < M; i++) {
    sum += A[i];
  }
  long int answer = N - sum;
  if (answer < 0)
    cout << -1 << endl;
  else
    cout << answer << endl;
  return 0;
}
