#include<stdio.h>
int main() {
    int n, m, a[10000], temp = 0;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int p = 0; p < m; p++)
    {
        temp = temp + a[p];
    }
    if (n >= temp)
    {
        printf("%d\n", n-temp);
    }
    else
    {
        printf("-1");
    }






    return 0;
}