#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define wt(v) {ulong _z=v;do*--wp=_z%10+48;while(_z/=10);} #define rep(v,e) for(long v=0;v10000||k>1000){ exit(1); } kp[1]=1; rep(i,n){ rd(ai); a[i]=ai; ulong q=ai/64; ulong r=ai%64; if(r){ rrep(j,32){ kp[j+q+1]|=kp[j+1]<>64-r; } } else{ rrep(j,32){ kp[j+q+1]|=kp[j+1]; } } } if(!(kp[k/64+1]&1l<