#include <stdio.h>

int main() {
	int N, M;
	int sum = 0;

	scanf("%d %d", &N, &M);
	for (int i = 0;i < M;i++) {
		int j = getchar();
		sum += j;
	}

	if (sum > N) {
		printf("-1");
	}
	else {
		printf("%d", N - sum);
	}

	return 0;
}