#include <stdio.h>

int main(void) {
    int n, m;
    scanf("%d%d", &n, &m);
    
    int a[m], total = 0;
    for(int i = 0; i < m; i++) {
        scanf("%d", &a[i]);
        total += a[i];
    }
    
    if(n < total) printf("-1");
    else printf("%d\n", n - total);
}
