def main(): N,W=map(int,input().split()) a=list(map(int,input().split())) ans=set() for i in range(1,pow(3,N)): s=0 M=i l=[] for j in range(N): if M%3==1: s+=a[j]//2 l.append(1) elif M%3==2: s+=a[j] l.append(1) else: l.append(0) M//=3 if s==W: ans.add("".join(map(str,l))) print(len(ans)) return main()