#include <stdio.h>
#include <math.h>

int main()
{

    int a;
    int b;
    scanf("%d %d", &a,&b);
    int c;
    int sum=0;
    for (int i = 0; i < b; i++)
    {
        scanf("%d", &c);
        sum = c + sum;
    }

    if(sum>a)
        printf("-1");
    else
        printf("%d", a - sum);
    printf("\n");
}