#include <stdio.h>

int main ()
{
    int n,m,a,sum,dif;
    while (scanf ("%d",&n)   !=EOF)
    {
        scanf ("%d",&m);
        sum = 0;
        for (int i=0;i<m;i++)
        {
            scanf ("%d",&a);
            sum+=a;
        }
        dif = n-sum;
          if (dif>=0)
            printf("%d\n",dif);
          else
            printf("-1\n");
    }
    return 0;
}
