#include<stdio.h>
int main (){
	int dia,a,sum=0;
    scanf("%d %d",&dia,&a);
    for (int i=1; i<=a; i++){
    	int x;
        scanf("%d",&x);
        sum=sum+x;
    }
    int ans=dia-sum;
    if (ans<0)
       	printf("-1\n");
    else
    	printf("%d\n",ans);
	return 0;
 }