#include<stdio.h>

int main(void) {
    unsigned int n;
    unsigned int m;
    unsigned int a[10000];
    unsigned int i,ans;
    scanf("%d %d", &n, &m);

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

    ans = 0;

    for (int i = 0; i < m; i++) {
        ans = ans + a[i];
    }
    
    if (n < ans) {
        printf("-1\n");
    }
    else {
        printf("%d",n-ans);
    }
    return 0;
}