#include <stdio.h>

int main() {
	int N, M, A[10000];
	long int sum=0;
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M;i++) {
		scanf("%d", &A[i]);
		sum += (long int)A[i];
	}
	if (sum > (long int)N)printf("-1");
	else printf("%ld", (long int)N - sum);
	return 0;
}