#include <stdio.h>

int main(){
unsigned long long int N,M;
unsigned long long int W=0;
unsigned long long int count;
  
scanf("%ld %ld",&N,&M);
  
unsigned long long int A;
  
for(count=0;count<M;count++){
  scanf("%ld" , &A);
  W+=A;
}
  
if(W > N) printf("-1\n");

else printf("%ld\n" , N-W);

return 0;

}