#include<stdio.h>

int main(){
   int N,M;
   int A[1001];
   int i;
   int count = 0;

   scanf("%d %d",&N,&M);

   for(i = 0;i<M;i++){
      scanf("%d",&A[i]);
      count += A[i];
   }
   if(count>N){
      printf("-1");
   }else{
      printf("%d",N-count);
   }
   return 0;
}
   