#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(data, 10, sizeof(int), compare_int)


int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	int array[m], sum=0;
	for(int i=0; i<m; i++){
		scanf("%d", &array[i]);
		sum += array[i];
	}

	if(sum > n) printf("-1\n");
	else printf("%d\n", n-sum);
	
	
	return 0;
}