#include<stdio.h>
int main()
{
	int M,N,i,sum=0,temp;
	scanf("%d %d",&M,&N);
	int A[N];
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
		sum=sum+A[i];
	}
	temp=M-sum;
	if(temp>=0){
		printf("%d\n",temp);
	}
	else{
		printf("-1\n");
	}
	return 0;
}
