#include <stdio.h>
#define M 10000

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