#include<stdio.h>

int main(void){
  int N,M,sum=0;
  int a[10009];
  scanf("%d %d\n",&N,&M );
  for(int i=0; i<M; i++){
    scanf("%d",&a[i] );
    sum += a[i];
  }
  if(N < sum){
    printf("-1" );
  }else{
    printf("%d\n",N - sum );
  }
  return 0;
}
