#include <bits/stdc++.h>
int main(void) {
  int N, M, i;
  scanf("%d %d\n", &N, &M);
  int A[M];
  for (i = 1; i <= M; i++) {
    scanf("%d,", &A[i]);
  }
  for (i = 1; i <= M; i++) {
    N = N - A[i];
  }
  if (N < 0) {
    printf("-1\n");
  } else {
    printf("%d\n", N);
  }
}
