#include<stdio.h>
int Question163B(void) {
	int n, m, a[10001], num = 0;

	scanf("%d%d", &n, &m);
	for (int k = 0; k < m; k++) {
		scanf("%d", &a[k]);
		num = num + a[k];
	}
	if (num > n) printf("%d\n", -1);
	else printf("%d\n", n - num);
	return 0;
}