n,s=map(int,input().split()) a=list(map(int,input().split())) def calc(m,b): dp=[0] for i in b: dp_new=[] tmp=1 while i**tmp<=s: for j in dp: if j+i**tmp<=s: dp_new.append(j+i**tmp) tmp+=1 dp=dp_new dp.sort() dp2=[] for i in dp: if len(dp2)==0: dp2.append([i,1]) elif dp2[-1][0]==i: dp2[-1][1]+=1 else: dp2.append([i,1]) cum=[] tmp=0 for i,j in dp2: tmp+=j cum.append([i,tmp]) return dp2,cum n1=n//2 n2=n-n1 dp,_=calc(n1,a[:n1]) _,cum=calc(n2,a[n1:]) cum=cum[::-1] m1=len(dp) m2=len(cum) ans=0 now=0 for i in range(m1): while nows: now+=1 if now!=m2: ans+=dp[i][1]*cum[now][1] print(ans)