#include <stdio.h>

int main(void) {
  int vday;
  int wday;
  scanf("%d",&vday);
  scanf("%d",&wday);
  int work[wday];
  int i;
  for(i = 0;i < wday;++i) {
    scanf("%d",&work[i]);
  }
  int sum = 0;
  for(i = 0;i < wday;++i) {
    sum += work[i];
  }
  if(sum > vday) {
    puts("-1");
  }
  else {
    printf("%d\n",vday - sum);
  }
  return 0;
}