n,S = map(int,input().split()) A = list(map(int,input().split())) A1 = A[:n//2] A2 = A[n//2:] def makeaccum(A,S): dicA = {} dicA[0] = 1 for a in A: ndicA = {} for k,v in dicA.items(): now = a for j in range(1,30): if k+now <= S: ndicA[k+now] = ndicA.get(k+now,0)+v now *= a dicA = ndicA s = sorted(set(dicA.keys())) accum = [0]+[dicA[i] for i in s] return accum,s accum1,s1 = makeaccum(A1,S) accum2,s2 = makeaccum(A2,S) for i in range(len(accum2)-1): accum2[i+1] += accum2[i] ans = 0 now = 0 l = len(s2) for a,s in zip(accum1[1:][::-1],s1[::-1]): while now < l and s+s2[now] <= S: now += 1 ans += a*accum2[now] print(ans)