import sys import bisect n,w = map(int,input().split()) a = list(map(int,input().split())) a2 = [i//2 for i in a] cnt=0 s = set(range(n)) for bit in range(1,1<>j)&1==1: li.append(j) l = len(li) if l==1: if a[li[0]]==w or a2[li[0]]==w: cnt+=1 continue cri = l//2 ll1 = [] for j in range(1<>k)&1==1: ka+= a2[li[k]] else: ka+= a[li[k]] ll1.append(ka) ll1.sort() ll2 = [] for j in range(1<<(l-cri)): ka = 0 for k in range(l-cri): if (j>>k)&1==1: ka+= a2[li[-1-k]] else: ka+= a[li[-1-k]] ll2.append(ka) ll2.sort() #print(li,":",ll1,ll2) for i in ll1: if i>w: continue ind = bisect.bisect(ll2,w-i) #print(ind,ll2[ind-1]) if ll2[ind-1]==w-i: cnt+=1 break print(cnt)