#include<stdio.h>
#include<stdlib.h>
int main(){
  int day, work, i, sum=0, fun;
  int *d;
  
  d=(int *)malloc(sizeof(int)*work);
  
  scanf("%d %d", &day, &work);
  
  for(i=0;i<work;i++){
  	scanf("%d", d[i]);
    sum+=d[i];
  }
  
  fun=day-sum;
  if(fun<0){
  	printf("-1\n");
  }
  else{
  	printf("%d", &fun);
  }
  
  return 0;
  
  
  
}
