#include <stdio.h>

int main()
{
    int n, m, a[10010];

    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++)
        scanf("%d", &a[i]);

    for (int i = 0; i < m; i++)
    {
        n -= a[i];
        if (n < 0)
        {
            n = -1;
            break;
        }
    }

    printf("%d", n);
    return 0;
}