    #include <stdio.h>

    int main()      /*this code is written by 190042146*/
{
    int n, m;

    scanf("%d%d", &n, &m);

    int i, ara[m];
    long long int sum=0;

    for (i=0;i<m;i++)
    {
        scanf("%d", &ara[i]);
    }

    for (i=0;i<m;i++)
    {
        sum=sum+ara[i];
    }

    if (sum>n)
    {
        printf("-1");
    }

    else
    {
        printf("%d",n-sum);
    }


    return 0;
}
