#include <stdio.h>

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

    int total;

    scanf("%d%d", &n, &m);

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

    if(n < total){
        printf("-1\n");
    }else{
        printf("%d\n", n-total);
    }
}