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