#include<stdio.h>
int main()
{
    int n,m, a, i=1, sum=0;

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

    while(i<=m)
    {
        scanf("%d", &a);

        sum = sum + a;

        i++;
    }

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

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

}
