#int(input()) #map(int, input().split()) #list(map(int, input().split())) n, S = map(int, input().split()) A = list(map(int, input().split())) B = A[n//2:] A = A[:n//2] d = dict() d[0] = 1 for i in range(len(A)): t = 1 a = A[i] nd = dict() while True: t *= a if t > S: break for x, v in d.items(): if x + t > S: continue elif x + t not in nd: nd[x+t] = v else: nd[x+t] += v d = dict(nd) da = dict(d) d = dict() d[0] = 1 for i in range(len(B)): t = 1 a = B[i] nd = dict() while True: t *= a if t > S: break for x, v in d.items(): if x + t > S: continue elif x + t not in nd: nd[x+t] = v else: nd[x+t] += v d = dict(nd) b = list(d.items()) b = sorted(b) s = [0] * (len(b) + 1) lb = [] for i in range(len(b)): s[i+1] = s[i] + b[i][1] lb.append(b[i][0]) # print(da) # print(d) import bisect ans = 0 # print(lb) for x, v in da.items(): t = bisect.bisect_right(lb, S-x) # print(t, S-x) ans += s[t] * v print(ans)