import sys readline=sys.stdin.readline def Hirschberg_Algorithm(N,lst,S,bit_set=False): partial_sum=[0]*(N+1) partial_sum[0]=0 partial_sum[N]=S stack=[(0,N)] while stack: l,r=stack.pop() mid=(l+r)//2 s=partial_sum[r]-partial_sum[l] if bit_set: dpL=Bit_Set(1,element_range=s+1) else: dpL=1 for i in range(l,mid): dpL|=dpL<>lst[i] dp=dpL&dpR if bit_set and not dp.bit_set or not bit_set and dp==0: return None partial_sum[mid]=partial_sum[l]+(dp.Find_First() if bit_set else (dp&-dp).bit_length()-1) if mid-l>=2: stack.append((l,mid)) if r-mid>=2: stack.append((mid,r)) return partial_sum N,X=map(int,readline().split()) A=list(map(int,readline().split())) M=10**5 idx0=[] idx1=[] s1=0 for i in range(N): if A[i]>=M: idx0.append(i) else: idx1.append(i) s1+=A[i] le0=len(idx0) le1=len(idx1) dp=1 for i in range(1,le1+1): dp|=dp<=X-s>=0 and dp&1<