#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int N, M, c, sum = 0;
    int *A;
    scanf("%d %d", &N, &M);
    A = (int *)malloc(sizeof(int) * M);
    for (c = 0; c < M; ++c)
    {
        scanf("%d", A + c);
        sum += A[c];
    }
    if (sum > N)
    {
        printf("-1");
    }
    else
    {
        printf("%d", N - sum);
    }
    free(A);
    return 0;
}