#include<stdio.h>
 
int main(void){
  int n,m,i,sum=0;
  int a[10000];
  int out;
  
  do{
    scanf("%d %d",&n,&m);
  }while(n<1 || n>1000000 || m<1 || m>10000);
  
  for(i=0; i<m; i++){
    do{
      scanf("%d",&a[i]);
    }while(a[i]<1 || a[i]>10000);
    sum += a[i];
  }
  
  out = n-sum;
  
  if(out>=0){
    printf("%d",out);
  }
  else{
    puts("-1");
  }
  
  return 0;
}