#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);}) #define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;}) #define wt(v) ({ulong _z=v;int neg=(long)_z<0?_z=-_z,1:0;do*--wp=_z%10+48;while(_z/=10);if(neg)*--wp='-';}) #define wt1(v) ({char wbuf[64],*wp=wbuf+sizeof wbuf;wt(v);write(1,wp,wbuf+sizeof wbuf-wp);}) #define rep(v,e) for(typeof(e) v=0;v>9|a[i]<<55; } }else{ for(int i=0;i>37|a[i]<<27; } } } void sort(ulong*a,int n){ static ulong b[1<<15]; sort_aux(a,b,n,0); sort_aux(b,a,n,0); sort_aux(a,b,n,0); sort_aux(b,a,n,1); } long v[2][1<<15]; int vn[2]; int main(){ rd_init(); int n=rd(); int k=rd(); long o=0; vn[0]=1; vn[1]=1; rep(i,n){ int neg=*rp=='-'&&++rp; long a=rd(); if(neg){ o-=a; } rep(j,vn[i&1]){ v[i&1][vn[i&1]+j]=v[i&1][j]+a; } vn[i&1]<<=1; } sort(v[0],vn[0]); sort(v[1],vn[1]); long lo=0,hi=1l<<34; while(lo+1>1; int c=vn[0]*vn[1]; int j=vn[1]-1; rep(i,vn[0]){ while(j>=0&&v[0][i]+v[1][j]>=z){ --j; } c-=j+1; } if(c