#include<stdio.h>
     
int main() {
   int N, M;
   int A[M];
   int count = 0;

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