n, S = map(int, input().split()) A = list(map(int, input().split())) if n == 1: a = A[0] x = a ans = 0 while x <= S: ans += 1 x *= a print(ans) exit() L = A[:n//2] R = A[n//2:] left = [0] for a in L: tmp = [] x = a while x < S: tmp.append(x) x *= a nl = [] for t in tmp: for l in left: if t + l <= S: nl.append(t + l) left = nl left.sort() right = [0] for a in R: tmp = [] x = a while x < S: tmp.append(x) x *= a nr = [] for t in tmp: for l in right: if t + l <= S: nr.append(t + l) right = nr right.sort() ans = 0 p = 0 left.append(S + 1) for r in right[::-1]: while r + left[p] <= S: p += 1 ans += p print(ans)