#include <stdio.h>
#include <stdbool.h>

int main(void) {
	int N, M;
	int A[10000];
	int must = 0;
	
	scanf("%d %d", &N, &M);
	for(int i = 0; i < M; i++) {
		scanf("%d", &A[i]);
		must += A[i];
	}
	
	if( N < must ) {
		printf("-1\n");
	} else {
		printf("%d\n", N - must);
	}

	return 0;
}
