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