#include <stdio.h>

int main(void) {

	int N, M, i, result;
	int A[10001];
	int sum = 0;

	scanf("%d %d", &N, &M);

	for (int i = 0; i < M;  i++) {

		scanf("%d", &A[i]);

		sum = sum + A[i];

	}

	for (int i = 0; i < M; i++) {

		result = N - sum;

	}

	if (result < 0) {
		printf("-1");
	}
	else {
		printf("%d", result);
	}

	return 0;
}