#include<stdio.h>
int main ()
{
    int m,n,arr[10001],c,i,d,sum=0,re;
    scanf ("%d %d",&m, &n);
    for (i=0;i<n;i++)
    {
        scanf ("%d",&arr[i]);

    }
    for (i=0;i<n;i++)
    {
        sum=arr[i]+sum;
    }
    c=m-sum;
    if (c>=0)
    {
        re=c;
    }
    else if (c<0)
    {
        re=-1;
    }
    printf ("%d\n",re);
    return 0;
}
