import bisect n, S = map(int, input().split()) a = list(map(int, input().split())) def generate_sums(half): sums = [0] for num in half: exponents = [] current = num while True: exponents.append(current) next_p = current * num if next_p > S: break current = next_p new_sums = [] for s in sums: for e in exponents: new_sum = s + e new_sums.append(new_sum) sums = new_sums return sums mid = n // 2 first_half = a[:mid] second_half = a[mid:] sum1 = generate_sums(first_half) sum2 = generate_sums(second_half) sum2.sort() total = 0 for s in sum1: if s > S: continue remaining = S - s if remaining < 0: continue cnt = bisect.bisect_right(sum2, remaining) total += cnt print(total)