#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,m;
    int *a;
    int homework=0;

    do{
        scanf("%d%d",&n,&m);
    }while(n<1||n>1000000||m<1||m>10000);

    a=(int *)malloc(m*sizeof(int));

    for(int i=0;i<m;i++){
        do{
            scanf("%d",&a[i]);
        }while(a[i]<1||a[i]>10000);
        homework+=a[i];
    }

    if(n-homework>=0){
        printf("%d",n-homework);
    }
    else{
        printf("%d",-1);
    }

    return 0;
}