#include<stdio.h>

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