#include <stdio.h>

int main(void)
{
    long long int N, M, answer = 0;
    long long int A[10000] = {0};


    scanf("%lld %lld", &N, &M);
    for (int i = 0; i < M; i++)
    {
        scanf("%lld", &A[i]);
    }

    answer = N;

    for (int j = 0; j < M; j++)
    {
        answer -= A[j];
    }

    if (answer < 0)
    {
        printf("-1");
    }

    else if (answer >= 0)
    {
        printf("%lld", answer);
    }
    
    
    
    
    return 0;
}