#include <stdio.h>

int N;
int M;
int A_[M];
int sum;
int answer;

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