#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>
#include<ctype.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int main() {

	int N,M;
	
	scanf("%d %d",&N,&M);
	
	int Homework[M];
	
	int days = 0;
	
	for(int i=0;i<M;i++){
		
		scanf("%d",&Homework[i]);
		
		days += Homework[i];
		
		if(days>N){
			printf("-1");
			return 0;
		}
		
	}
	printf("%d",N-days);
	
	
	return 0;
}