#include<stdio.h>

int main(){
   int n, m;
   scanf("%d %d", &n, &m);
   int a[m];
   int days = 0;
   for(int i=0; i<m; i++){
      scanf("%d", &a[i]);
      days += a[i];
   }

   if((n - days) >= 0){
      printf("%d", days);
   } else {
      printf("%d", -1);
   }

   return 0;
}
