#include<cstdio>

int main(){
	int N, M;
	scanf("%d %d", &N, &M);
	for (int i = 0; i < M && N >= 0; ++i)
	{
		int tmp;
		scanf("%d", &tmp);
		N -= tmp;
	}
	printf("%d\n", N >= 0 ? N : -1);
	return 0;
}