#include<stdio.h>
int main()
{
    long int n,t,i,sum=0,a[1005];
    scanf("%ld %ld",&n,&t);
    for(i=0; i<t; i++)
    {
        scanf("%d",&a[i]);
        sum=sum+a[i];
    }
    if(n>=sum){
    printf("%ld\n",n-sum);
    }
    else
    {
        printf("-1\n");
    }
return 0;
}
