#include <stdio.h>

int main(void){
 int sv, hw, i, length, res, sum = 0;
 char a[10000];
 scanf("%d %d",&sv, &hw); 
 for(i = 0; i == hw; ++i){
    scanf("%d",&a[i]);
    sum = sum + a[i];
 }
 res = sv - sum;
 if(res < 0){
   printf("-1");
 } else {
   printf("%d",res);
 }
 return 0;
}