#include <stdio.h>

int main(){
	int N,M;
	scanf("%d %d",&N,&M);
	int A[M];
	int total=0;
	for (int i = 0; i < M; ++i)
	{
		scanf("%d",&A[i]);
		total+=A[i];
	}

	if(total <= N){
		printf("%d",N-total);
	}else{
		printf("-1");
	}
	return 0;
}
