#include <stdio.h>

int main(void){
    long i,n,m,sum=0,dummy;
    dummy=scanf("%ld %ld",&n,&m);
    dummy=getchar();
    long day[m];
    for(i=1;i<=m;i++){
        dummy=scanf("%ld ",day[i]);
        sum+=day[i];
    }
    if(sum>n)printf("-1");
    else printf("%ld",n-sum);
    return 0;
}