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