Read problems statements in mandarin chinese, russian and vietnamese as well. 

Though our Head Chef retired from sport programming long back, but that did not affect his passion to contribute to the programming community. He still remains engaged by creating new problems and passing it on to the online judges. Last Night, he thought of a following problem for which he could not figure out a solution. You being his friend from the older days of programming decide to help him.

Find the number of non-empty subsequences in the given list of N integers such that the product of the values in the subsequences does not exceed K

------ Input ------ 

First line of the input will contain two space separated integers N and K. Next and last line of the input contains N space separated integers

------ Output ------ 

Print the answer to the given test case in a separate line.

------ Constraints ------ 

$1 ≤ N ≤ 30$
$1 ≤ K, A_{i} ≤ 10^{18}$

------ Subtasks ------ 

Subtask #1 : (30 points)

$1 ≤ N ≤ 10$

Subtask #2 : (70 points) 

$1 ≤ N ≤ 30$

----- Sample Input 1 ------ 
3 4

1 2 3
----- Sample Output 1 ------ 
5
----- explanation 1 ------ 

For the given sample case, there are 7 non-empty subsequences out of which 2 have their product > 4. Those include {2, 3} and {1, 2, 3}. Hence, the answer is 7 - 2 = 5.

Difficulty: HARD

Solutions:
import bisect

def create_subsets(arr, k):
	subset = []
	l = len(arr)
	val = 2 ** l
	for i in range(val):
		s = 1
		for j in range(l):
			if i & 1 << j:
				s *= arr[j]
		if s <= k:
			subset.append(s)
	subset.sort()
	return subset
(n, k) = [int(c) for c in input().split()]
arr = [int(c) for c in input().split()]
b = arr[:n // 2]
c = arr[n // 2:]
subset1 = create_subsets(b, k)
subset2 = create_subsets(c, k)
ans = 0
for i in subset1:
	ans += bisect.bisect_right(subset2, k // i)
print(ans - 1)


import bisect
import sys

def subsets(x, n, K):
	ans = []
	for i in range(1 << n):
		pro = 1
		for j in range(n):
			if 1 << j & i:
				if pro > K:
					break
				pro *= x[j]
		if pro <= K:
			ans.append(pro)
	ans.sort()
	return ans
inpos = sys.stdin
(n, k) = list(map(int, inpos.readline().split()))
a = list(map(int, inpos.readline().split()))
b = a[:n // 2]
c = a[n // 2:]
m = len(b)
n = len(c)
b = subsets(b, m, k)
c = subsets(c, n, k)
ans = 0
size = len(b)
for i in range(size):
	ans += bisect.bisect_right(c, k // b[i])
print(ans - 1)


lst1 = []
lst2 = []
sec_sum1 = []
sec_sum2 = []

def rec1(pos, sum):
	if pos == len(lst1):
		sec_sum1.append(sum)
		return
	rec1(pos + 1, sum * lst1[pos])
	rec1(pos + 1, sum)

def rec2(pos, sum):
	if pos == len(lst2):
		sec_sum2.append(sum)
		return
	rec2(pos + 1, sum * lst2[pos])
	rec2(pos + 1, sum)

def binary_search(key, high):
	(hi, lo, mid, ans) = (len(sec_sum2) - 1, 1, 0, 0)
	while hi >= lo:
		mid = int((hi + lo) / 2)
		if key * sec_sum2[mid] <= high:
			lo = mid + 1
			ans = mid
		else:
			hi = mid - 1
	return ans
(n, m) = map(int, input().split(' '))
A = [int(a) for a in input().split()]
for i in range(0, n, 1):
	if i % 2 == 0:
		lst1.append(A[i])
	else:
		lst2.append(A[i])
rec1(0, 1)
rec2(0, 1)
sec_sum1.sort()
sec_sum2.sort()
maxi = 0
for i in range(1, len(sec_sum1), 1):
	if sec_sum1[i] <= m:
		maxi += 1
for i in range(1, len(sec_sum2), 1):
	if sec_sum2[i] <= m:
		maxi += 1
for i in range(1, len(sec_sum1), 1):
	if sec_sum1[i] > m:
		break
	cur = binary_search(sec_sum1[i], m)
	maxi += cur
print(maxi)


import sys
import bisect
MAX = 100005
inpos = sys.stdin
[n, K] = list(map(int, inpos.readline().split()))
a = list(map(int, inpos.readline().split()))
b = a[:n // 2]
c = a[n // 2:]
l = len(b)
up = 1 << l
subset1 = []
for i in range(up):
	prod = 1
	for j in range(l):
		if i & 1 << j:
			prod *= b[j]
	if prod <= K:
		subset1.append(prod)
subset1.sort()
l = len(c)
up = 1 << l
subset2 = []
for i in range(up):
	prod = 1
	for j in range(l):
		if i & 1 << j:
			prod *= c[j]
	if prod <= K:
		subset2.append(prod)
subset2.sort()
ans = 0
l = len(subset1)
for i in range(l):
	ans += bisect.bisect_right(subset2, K // subset1[i])
print(ans - 1)


def fun(arr, m):
	d = []
	for i in range(1, pow(2, len(arr))):
		cnt = 1
		for j in range(len(arr)):
			if i & 1 << j:
				cnt *= int(arr[j])
				if cnt > m:
					break
		if cnt <= m:
			d.append(cnt)
	return d

def binsearch(arr, value):
	high = len(arr)
	low = 0
	while low < high:
		mid = (low + high) // 2
		if arr[mid] > value:
			high = mid
		elif arr[mid] <= value:
			low = mid + 1
	return low
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = a[0:n // 2]
c = a[n // 2:n]
e = fun(b, m)
f = fun(c, m)
e.sort()
f.sort()
cnt = len(e) + len(f)
for i in e:
	cnt += binsearch(f, m // i)
print(cnt)


import bisect
(n, k) = [int(c) for c in input().split()]
arr = [int(c) for c in input().split()]
b = arr[:n // 2]
c = arr[n // 2:]
bit = 1 << len(b)
subset1 = []
for i in range(bit):
	prod = 1
	for j in range(len(b)):
		if 1 << j & i:
			prod *= b[j]
	if prod <= k:
		subset1.append(prod)
bit = 1 << len(c)
subset2 = []
for i in range(bit):
	prod = 1
	for j in range(len(c)):
		if 1 << j & i:
			prod *= c[j]
	if prod <= k:
		subset2.append(prod)
ans = 0
subset2.sort()
for i in subset1:
	ans += bisect.bisect(subset2, k // i)
print(ans - 1)


from bisect import bisect_right
(n, k) = [int(d) for d in input().split()]
arr = [int(d) for d in input().split()]
result = 0
half = n >> 1
prods = [1] * (1 << half)
for i in range(1, 1 << half):
	for j in range(half):
		if i & 1 << j:
			prods[i] *= arr[j]
	if prods[i] <= k:
		result += 1
prods.sort()
otherHalf = n - half
for i in range(1, 1 << otherHalf):
	p = 1
	for j in range(half, n):
		if i & 1 << j - half:
			p *= arr[j]
	if p <= k:
		result += 1
		index = bisect_right(prods, k / p)
		result += index - 1
print(result)


(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
l1 = l[0:n // 2]
l2 = l[n // 2:]
set1 = []
set2 = []

def prod(curr):
	p = 1
	if not curr:
		return 0
	for i in curr:
		p *= i
	return p
tot = 1 << len(l1)
from collections import defaultdict
d1 = defaultdict(int)
for i in range(tot):
	curr = []
	for j in range(len(l1)):
		if 1 << j & i:
			curr.append(l1[j])
	if not prod(curr):
		continue
	set1.append(prod(curr))
ans = 0
tot = 1 << len(l2)
for i in range(1, tot):
	curr = []
	for j in range(len(l2)):
		if 1 << j & i:
			curr.append(l2[j])
	if prod(curr):
		set2.append(prod(curr))
set1.sort()
set2.sort()
from collections import Counter
c = Counter(set2)
from bisect import bisect_left as bl

def check(x):
	req = k // x
	lo = 0
	hi = len(set2) - 1
	ans = -1
	while lo <= hi:
		mi = lo + hi >> 1
		if set2[mi] <= req:
			ans = mi
			lo = mi + 1
		else:
			hi = mi - 1
	return ans + 1
ans = 0
for i in set1:
	ans += i <= k
for i in set2:
	ans += i <= k
for i in set1:
	if i > k:
		break
	ans += check(i)
print(ans)


import bisect

def getProduct(l, n, ans, k):
	for i in range(1, 1 << n):
		p = 1
		for j in range(n):
			if i & 1 << j != 0:
				p *= l[j]
		if p <= k:
			ans.append(p)
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
(l1, l2) = (l[:n // 2], l[n // 2:])
(n1, n2) = (len(l1), len(l2))
(ans1, ans2) = ([], [])
getProduct(l1, n1, ans1, k)
getProduct(l2, n2, ans2, k)
ans1.sort()
ans2.sort()
cnt = 0
for i in ans1:
	cnt += bisect.bisect(ans2, k // i)
cnt += bisect.bisect(ans1, k)
cnt += bisect.bisect(ans2, k)
print(cnt)


def solve(l, idx, n, k, p, t):
	if p > k:
		return None
	if idx == n:
		t.append(p)
		return None
	solve(l, idx + 1, n, k, p, t)
	solve(l, idx + 1, n, k, p * l[idx], t)

def search(l, k, val):
	lo = 1
	hi = len(l) - 1
	ans = len(l)
	while lo <= hi:
		mid = (lo + hi) // 2
		if val * l[mid] > k:
			hi = mid - 1
		else:
			ans = mid
			lo = mid + 1
	return ans
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
t = []
d = []
solve(l, 0, n // 2, k, 1, t)
solve(l, n // 2, n, k, 1, d)
ans = len(t) + len(d) - 2
t.sort()
d.sort()
for i in t[1:]:
	idx = search(d, k, i)
	if idx != len(d):
		ans += idx
print(ans)


import bisect
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
one = arr[0:n // 2]
two = arr[n // 2:]
n1 = len(one)
raja = []
for i in range(1 << n1):
	prod = 1
	for j in range(n1):
		if i & 1 << j:
			prod *= one[j]
	if prod <= k:
		raja.append(prod)
raja.sort()
n2 = len(two)
rani = []
for i in range(1 << n2):
	prod = 1
	for j in range(n2):
		if i & 1 << j:
			prod *= two[j]
	if prod <= k:
		rani.append(prod)
rani.sort()
ans = 0
for i in range(len(raja)):
	ans += bisect.bisect_right(rani, k // raja[i])
print(ans - 1)


t = 1
MOD = 10 ** 9 + 7
import math
while t:
	(n, k) = map(int, input().split())
	l = [int(i) for i in input().split()]
	l.sort()
	sum = 1
	c = 0
	a = l[0:n // 2]
	b = l[n // 2:]
	ans = []
	ans1 = []
	opsize = math.pow(2, len(a))
	for counter in range(0, int(opsize)):
		y = []
		for j in range(0, len(a)):
			if counter & 1 << j:
				y.append(l[j])
		prod = 1
		for i in range(len(y)):
			prod *= y[i]
		ans.append(prod)
	opsize = math.pow(2, len(b))
	for counter in range(0, int(opsize)):
		y = []
		for j in range(0, len(b)):
			if counter & 1 << j:
				y.append(b[j])
		prod = 1
		for i in range(len(y)):
			prod *= y[i]
		ans1.append(prod)
	ans1.sort()
	from bisect import bisect_right as br
	z = 0
	for i in ans:
		z += br(ans1, k // i)
	print(z - 1)
	t = t - 1


import sys, bisect

def subset(p_b, b, k):
	len_b = len(b)
	for i in range(1, 1 << len_b):
		ans = 1
		for j in range(len_b):
			if i & 1 << j:
				ans *= b[j]
		if ans <= k:
			p_b.append(ans)
(n, k) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = a[:n // 2]
c = a[n // 2:]
ans = 0
p_b = []
p_c = []
subset(p_b, b, k)
subset(p_c, c, k)
p_b.sort()
p_c.sort()
len_b = len(p_b)
for i in range(len_b):
	if p_b[i] <= k:
		ans += 1
	else:
		break
len_c = len(p_c)
for i in range(len_c):
	if p_c[i] <= k:
		ans += 1
	else:
		break
for i in range(len_b):
	j = bisect.bisect_right(p_c, k // p_b[i])
	ans += j
print(ans)


import operator
import functools

def subsets(a, k):
	l = len(a)
	m = 1 << l
	subs = []
	pad = [0] * l
	for i in range(m):
		b = pad + list(map(int, list(bin(i)[2:])))
		b = b[-l:]
		c = [x * y for (x, y) in zip(a, b)]
		c = [1 if x == 0 else x for x in c]
		prod = functools.reduce(operator.mul, c, 1)
		if prod <= k:
			subs.append(prod)
	return subs

def Main():
	(n, k) = list(map(int, input().rstrip().split()))
	a = list(map(int, input().rstrip().split()))
	a.sort()
	b = a[:n // 2]
	c = a[n // 2:]
	b_subs = subsets(b, k)
	c_subs = subsets(c, k)
	b_subs.sort()
	c_subs.sort()
	j = len(c_subs) - 1
	ans = 0
	for (i, e) in enumerate(b_subs):
		while c_subs[j] > k // e:
			j -= 1
		ans += j + 1
		if i == 0:
			ans -= 1
	print(ans)
Main()


from collections import deque

def subsets(a, k):
	l = len(a)
	m = 1 << l
	subs = []
	for i in range(m):
		x = i
		j = 0
		prod = 1
		valid = True
		while x > 0:
			if x & 1:
				if prod > k // a[j]:
					valid = False
					break
				prod = prod * a[j]
			x = x >> 1
			j += 1
		if valid:
			subs.append(prod)
	return subs

def Main():
	(n, k) = list(map(int, input().rstrip().split()))
	a = list(map(int, input().rstrip().split()))
	a.sort()
	b = a[:n // 2]
	c = a[n // 2:]
	b_subs = subsets(b, k)
	c_subs = subsets(c, k)
	b_subs.sort()
	c_subs.sort()
	j = len(c_subs) - 1
	ans = 0
	for (i, e) in enumerate(b_subs):
		while c_subs[j] > k // e:
			j -= 1
		ans += j + 1
		if i == 0:
			ans -= 1
	print(ans)
Main()


from sys import stdin, stdout
inp = lambda : map(int, stdin.readline().split())
from bisect import bisect_right as br
(n, k) = inp()
a = list(inp())
l = len(a) // 2
b = a[:l]
c = a[l:]
subset1 = []
subset2 = []
l = len(b)
for i in range(1 << l):
	prod = 1
	for j in range(l):
		if i & 1 << j:
			prod *= b[j]
	if prod <= k:
		subset1.append(prod)
l = len(c)
for i in range(1 << l):
	prod = 1
	for j in range(l):
		if i & 1 << j:
			prod *= c[j]
	if prod <= k:
		subset2.append(prod)
subset1.sort()
subset2.sort()
ans = 0
for i in range(len(subset1)):
	ans += br(subset2, k // subset1[i])
print(ans - 1)


import sys
import itertools
from functools import reduce
import bisect
(n, k) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = a[:n // 2]
c = a[n // 2:]
t1 = []
t2 = []
count = 0
for i in range(len(b)):
	for subset in itertools.combinations(b, i + 1):
		temp = reduce(lambda x, y: x * y, subset)
		if temp < k:
			t1.append(temp)
			count += 1
for i in range(len(c)):
	for subset in itertools.combinations(c, i + 1):
		temp = reduce(lambda x, y: x * y, subset)
		if temp < k:
			t2.append(temp)
			count += 1
t1.sort()
t2.sort()
for i in range(len(t1)):
	idx = bisect.bisect_left(t2, k // t1[i] + 1)
	if idx != 0:
		idx -= 1
		count += idx + 1
print(count)


import bisect
(n, k) = map(int, input().strip().split(' '))
arr = list(map(int, input().strip().split(' ')))
a = arr[:n // 2]
b = arr[n // 2:]
l1 = len(a)
subset1 = []
power = 1 << l1
for i in range(power):
	prod = 1
	for j in range(l1):
		if i & 1 << j:
			prod *= a[j]
	if prod <= k:
		subset1.append(prod)
subset1.sort()
l2 = len(b)
subset2 = []
power = 1 << l2
for i in range(power):
	prod = 1
	for j in range(l2):
		if i & 1 << j:
			prod *= b[j]
	if prod <= k:
		subset2.append(prod)
ans = 0
subset2.sort()
for i in subset1:
	ans += bisect.bisect_right(subset2, k // i)
print(ans - 1)


import bisect
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
a = l[:n // 2]
b = l[n // 2:]
p = []
q = []
s = 0
o = len(a)
u = 1 << o
for i in range(u):
	prod = 1
	for j in range(n):
		if i & 1 << j:
			prod *= a[j]
	if prod <= k:
		p.append(prod)
p.sort()
o = len(b)
u = 1 << o
for i in range(u):
	prod = 1
	for j in range(n):
		if i & 1 << j:
			prod *= b[j]
	if prod <= k:
		q.append(prod)
q.sort()
l = len(p)
for i in range(l):
	s += bisect.bisect_right(q, k // p[i])
print(s - 1)


import bisect
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = a[:n // 2]
c = a[n // 2:]
s1 = []
s2 = []
for i in range(1 << len(b)):
	prod = 1
	for j in range(len(b)):
		if i & 1 << j:
			prod *= b[j]
	if prod <= k:
		s1.append(prod)
for i in range(1 << len(c)):
	prod = 1
	for j in range(len(c)):
		if i & 1 << j:
			prod *= c[j]
	if prod <= k:
		s2.append(prod)
s1.sort()
s2.sort()
ans = 0
for i in range(len(s1)):
	ans += bisect.bisect_right(s2, k / s1[i])
print(ans - 1)


import math
(n, k) = [int(x) for x in input().split()]
arr = input()
l = list(map(int, arr.split(' ')))
list1 = []
list2 = []
x = 0
while x < n / 2:
	list1.append(l[x])
	x = x + 1
while x < n:
	list2.append(l[x])
	x += 1

def subproduct(li, nb):
	b = []
	up = 1 << nb
	global ans
	for i in range(1, up):
		prod = 1
		flag = 1
		for j in range(0, nb):
			if i & 1 << j:
				if li[j] < k / prod:
					prod = prod * li[j]
				else:
					flag = 0
					break
		if flag == 1:
			b.append(prod)
	return b
ans = 0
b = subproduct(list1, len(list1))
c = subproduct(list2, len(list2))
ans += len(b) + len(c)
c.sort()

def BS(start, end, li, target):
	while start <= end:
		mid = (start + end) // 2
		if li[mid] <= target:
			start = mid + 1
		else:
			end = mid - 1
	return start
for i in b:
	ind = BS(0, len(c) - 1, c, k / i)
	ans += ind
print(ans)


import bisect
(n, k) = map(int, input().split())
b = list(map(int, input().split()))
a1 = b[0:int(n / 2)]
a2 = b[int(n / 2):]
a1.sort()
a2.sort()
v1 = []
v2 = []

def myc(a, i, p, s, v):
	if s == 1:
		if a[i] <= k:
			v.append(a[i])
		j = i + 1
		while j < len(a):
			myc(a, j, a[i], 2, v)
			j += 1
	else:
		p = p * a[i]
		if p <= k:
			v.append(p)
			j = i + 1
			while j < len(a):
				myc(a, j, p, 2, v)
				j += 1
for j in range(len(a1)):
	myc(a1, j, 1, 1, v1)
for j in range(len(a2)):
	myc(a2, j, 1, 1, v2)
v1.sort()
v2.sort()
c = 0
for i in v1:
	u = float(k / i)
	c += bisect.bisect(v2, u)
print(c + len(v1) + len(v2))


from functools import reduce
from itertools import chain, combinations
from operator import mul

def powerset(iterable):
	s = list(iterable)
	return chain.from_iterable((combinations(s, r) for r in range(1, len(s) + 1)))
(n, k) = [int(x) for x in input().strip().split()]
a = [int(x) for x in input().strip().split()]
d = n // 2
b = a[:d]
c = a[d:]
bx = []
for x in powerset(b):
	bx.append(reduce(mul, x, 1))
bx.sort()
cx = []
for x in powerset(c):
	cx.append(reduce(mul, x, 1))
cx.sort()
r = sum((x <= k for x in bx))
r += sum((x <= k for x in cx))
(i, j) = (0, len(cx) - 1)
while i < len(bx):
	while j >= 0 and bx[i] * cx[j] > k:
		j -= 1
	r += j + 1
	i += 1
print(r)


n = input()
r = list(map(int, n.split()))
k = r[1]
arr = input()
li = list(map(int, arr.split()))

def count(li, k):
	li.sort()
	if li[0] > k:
		print(0)
		return
	l = len(li)
	if l == 1:
		if li[0] <= k:
			print(1)
			return
	li1 = li[:int(len(li) / 2)]
	li2 = li[int(len(li) / 2):len(li)]
	nl1 = count1(li1, k)
	nl2 = count1(li2, k)
	count = 0
	count = len(nl1) + len(nl2)
	nl1.sort()
	nl2.sort()
	l1 = len(nl1)
	l2 = len(nl2)
	i = l1 - 1
	j = 0
	while i >= 0:
		d = k / nl1[i]
		while j < l2:
			if nl2[j] > d:
				break
			j = j + 1
		if j > 0:
			count = count + j
		i = i - 1
	print(count)

def count1(li, k):
	nl = []
	i = 0
	if li[0] > k:
		return nl
	if li[0] <= k:
		nl.append(li[i])
	i = i + 1
	pr = 0
	while i < len(li):
		a = len(nl)
		d1 = k / li[i]
		for j in range(a):
			pr = li[i] * nl[j]
			if nl[j] <= d1:
				nl.append(pr)
		if li[i] <= k:
			nl.append(li[i])
		i = i + 1
	return nl
count(li, k)


from bisect import bisect
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
left = A[:N // 2]
right = A[N // 2:]
left_vals = []
right_vals = []
left_limit = len(left)
for i in range(1 << left_limit):
	val = 1
	for j in range(left_limit):
		if i & 1 << j:
			val *= left[j]
	left_vals.append(val)
right_limit = len(right)
for i in range(1 << right_limit):
	val = 1
	for j in range(right_limit):
		if i & 1 << j:
			val *= right[j]
	right_vals.append(val)
left_vals.sort()
right_vals.sort()
ans = 0
for left_val in left_vals:
	ans += bisect(right_vals, K // left_val)
print(ans - 1)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
onecount = l.count(1)
dlist = list()
(s, ac) = (0, 0)
(asd, z) = (0, 0)
for i in range(n):
	t = l[i]
	if i == 0 and t != 1:
		if t <= k:
			dlist.append(t)
			s = s + 1
			ac = ac + 1
	else:
		asd = ac
		z = 0
		if t <= k and t != 1:
			for j in range(ac):
				x = t * dlist[j]
				if x <= k:
					s = s + 1
					dlist.append(x)
					z = z + 1
			dlist.append(t)
			z = z + 1
			s = s + 1
		ac += z
res = (pow(2, onecount) - 1) * (1 + s) + s
print(res)


(n, k) = input().split()
n = int(n)
k = int(k)
l = [int(x) for x in input().split()]
d = dict()
for i in range(n):
	if l[i] > k:
		continue
	copy = dict()
	for key in d:
		copy[key] = d[key]
	for key in copy:
		mult = key * l[i]
		if mult <= k:
			if not mult in copy:
				d[mult] = copy[key]
			else:
				d[mult] = d[mult] + copy[key]
	if not l[i] in d:
		d[l[i]] = 1
	else:
		d[l[i]] = d[l[i]] + 1
sm = 0
for key in d:
	sm = sm + d[key]
print(sm)


def p(s, t):
	count = 0
	lst = []
	pro = []
	for i in range(0, len(s)):
		if int(s[i]) == 1:
			count = count + 1
		elif int(s[i]) <= t:
			lst.append(int(s[i]))
	lst.sort()
	pro.append(1)
	for k in range(0, len(lst)):
		pro.sort()
		curr = len(pro)
		for j in range(0, curr):
			product = lst[k] * pro[j]
			if product <= t:
				pro.append(product)
			else:
				break
	set1 = len(pro) - 1
	set2 = 2 ** count - 1
	set3 = set1 * set2
	return set1 + set2 + set3
line1 = input()
x = line1.split()
line2 = input()
y = line2.split()
z = p(y, int(x[1]))
print(z)


i = input()
s = i.split()
N = eval(s[0])
K = eval(s[1])
arrElem = input()
a = arrElem.split()
A = []
totsets = 2 ** N - 1
count = 0
for i in range(0, N):
	A.append(eval(a[i]))
A.sort()
prod = []
req = []
count1 = 0
for i in range(0, N):
	if A[i] <= K and A[i] != 1:
		req.append(A[i])
	elif A[i] == 1:
		count1 = count1 + 1
noOfOnesSubsets = 2 ** count1 - 1
for i in range(0, len(req)):
	prod.sort()
	l = len(prod)
	if req[i] <= K:
		prod.append(req[i])
	for j in range(0, l):
		if req[i] * prod[j] <= K:
			prod.append(req[i] * prod[j])
		else:
			break
count = len(prod)
print((count + 1) * noOfOnesSubsets + count)


memo = {}

def countSS(v, lim, curr, i):
	key = '%d,%d' % (curr, i)
	if i < 0:
		return 0
	if key in memo:
		return memo[key]
	cnt = 0
	ii = i
	while i >= 0:
		mul = curr * v[i]
		if mul <= lim:
			cnt += 1
			cnt += countSS(v, lim, mul, i - 1)
		i -= 1
	memo[key] = cnt
	return cnt
(N, K) = map(int, input().split())
V = list(map(int, input().split()))
print(countSS(V, K, 1, N - 1))


(n, k) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
left = []
right = []
for i in range(n // 2):
	sz = len(left)
	for j in range(sz):
		left.append(left[j] * arr[i])
	left.append(arr[i])
for i in range(n // 2, n):
	sz = len(right)
	for j in range(sz):
		right.append(right[j] * arr[i])
	right.append(arr[i])
left.sort()
right.sort()
ans = 0
for i in left:
	if i <= k:
		ans += 1
for j in right:
	if j <= k:
		ans += 1
for i in left:
	lo = 0
	hi = len(right) - 1
	while lo < hi:
		md = lo + (hi - lo + 1) // 2
		if right[md] * i <= k:
			lo = md
		else:
			hi = md - 1
	if i * right[hi] <= k:
		ans += hi + 1
print(ans)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
a = [int(x) for x in input().split(' ')]
c = 0
a.sort()
m = n
index = n
temp = 1
for i in range(n):
	temp *= a[i]
	if a[i] > k:
		if c == 0:
			index = i
		c += 2 ** (m - 1)
		m -= 1
if temp <= k:
	a = []
a = a[:index]
flag = 0
ctr = a.count(1)
if ctr > 0:
	a = a[ctr:]
	flag = 1
product = [1]
p = []
for i in range(len(a)):
	for j in range(len(product)):
		if product[j] * a[i] > k:
			if flag:
				c += 2 ** ctr * 2 ** (len(a) - i - 1) * (len(product) - j)
			else:
				c += 2 ** (len(a) - i - 1) * (len(product) - j)
			break
		p.append(product[j] * a[i])
	product += p
	product.sort()
	p = []
print(2 ** n - 1 - c)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
a = [int(x) for x in input().split(' ')]
c = 0
a.sort()
m = n
index = n
temp = 1
for i in range(n):
	temp *= a[i]
	if a[i] > k:
		if c == 0:
			index = i
		c += 2 ** (m - 1)
		m -= 1
if temp <= k:
	a = []
a = a[:index]
flag = 0
ctr = a.count(1)
if ctr > 0:
	a = a[ctr:]
	flag = 1
subsets = [[]]
product = [1]
p = []
t = []
for i in range(len(a)):
	flag2 = 0
	for j in range(len(product)):
		if product[j] * a[i] <= k:
			if flag2 == 0:
				flag2 = 1
				if flag:
					c += 2 ** ctr * 2 ** (len(a) - i - 1) * j
				else:
					c += 2 ** (len(a) - i - 1) * j
			p.append(product[j] * a[i])
	product += p
	if len(p) > 0:
		product.sort(reverse=True)
	p = []
print(2 ** n - 1 - c)


(n, k) = list(map(int, input().split()))
oldarray = list(map(int, input().split()))
array = []
c = 0
for i in oldarray:
	if i != 1:
		array.append(i)
	else:
		c += 1
n = n - c
newArray = []
x = 0
for i in range(n):
	if array[i] <= k:
		g = 0
		t = 0
		while g < x:
			if array[i] * newArray[g] <= k:
				newArray.append(array[i] * newArray[g])
				t += 1
			g += 1
		newArray.append(array[i])
		x += 1 + t
print(x * 2 ** c + 2 ** c - 1)


def func(array, n, pro):
	if pro > maxi:
		return 0
	if n == 0:
		return 1
	if array[n - 1] > maxi:
		return func(array, n - 1, pro)
	return func(array, n - 1, pro) + func(array, n - 1, pro * array[n - 1])
su = 0
li = list(map(int, input().split()))
N = li[0]
maxi = li[1]
cnt = 0
arr = list(map(int, input().split()))
arr.sort()
ind = 0
flag = 0
for i in range(N):
	if arr[i] == 1:
		ind = i
		flag = 1
if flag == 1:
	numones = ind + 1
	newarr = arr[ind + 1:]
else:
	numones = 0
	newarr = arr
num = func(newarr, len(newarr), 1)
y = 2 ** numones
z = y - 1 + (num - 1) * y
print(z)


li = list(map(int, input().split()))
N = li[0]
maxval = li[1]
cnt = 0
arr = list(map(int, input().split()))
arr.sort()
array = [1]
ind = 0
flag = 0
for j in range(N):
	if arr[j] == 1:
		ind = j
		flag = 1
if flag == 1:
	numones = ind + 1
	newarr = arr[ind + 1:]
else:
	numones = 0
	newarr = arr
sum1 = 0
for u in range(numones + 1):
	sum1 = sum1 + u
for i in range(len(newarr)):
	num = newarr[i]
	l = len(array)
	k = 0
	for k in range(l):
		pro = num * array[k]
		if pro <= maxval:
			array.append(pro)
		else:
			break
		k = k + 1
	array.sort()
x = 2 ** numones
ans2 = x - 1 + (len(array) - 1) * x
print(ans2)


def checkProduct(index, Product):
	if Product > N[1]:
		return 0
	if index < len(L):
		return checkProduct(index + 1, Product) + checkProduct(index + 1, Product * L[index])
	elif Product <= N[1]:
		return 1
	else:
		return 0
N = list(map(int, input().split()))
L = list(map(int, input().split()))
Cou = L.count(1)
L = sorted((x for x in L if x <= N[1] and x > 1))
print(checkProduct(0, 1) * 2 ** Cou - 1)


from bisect import bisect_right

def comb(s, low, high, k):
	size = high - low + 1
	li = []
	for i in range(1, 1 << size):
		flag = 0
		pro = 1
		for j in range(0, size):
			if i >> j & 1 == 1:
				pro = pro * s[j + low]
				if pro > k:
					flag = 1
					break
		if flag == 0:
			li.append(pro)
	return li
(n, k) = list(map(int, input().split(' ')))
s = list(map(int, input().split(' ')))
li1 = comb(s, 0, n // 2 - 1, k)
li2 = comb(s, n // 2, n - 1, k)
li2.sort()
total = 0
for i in li1:
	term = k // i
	pos = bisect_right(li2, term, lo=0, hi=len(li2))
	total += pos
print(len(li1) + len(li2) + total)


string = input()
val = string.split()
int_val = [int(o) for o in val]
(N, K) = int_val
line = input()
l = line.split()
int_l = [int(x) for x in l]
int_l.sort()
nonones = []
for i in int_l:
	if i != 1:
		nonones.append(i)
noofones = len(int_l) - len(nonones)
list = [1]
count = 0
for i in nonones:
	list_temp = []
	for j in list:
		if i * j <= K:
			list_temp.append(i * j)
			count += 1
		else:
			break
	list.extend(list_temp)
	list.sort()
print(int(count * 2 ** noofones + (2 ** noofones - 1)))


def solve(a, count, m, x, n, i):
	if i >= n:
		return count
	while i < n:
		y = x
		x *= a[i]
		if x > m or x < y or x > 10 ** 18:
			count += pow(2, n - i - 1)
		else:
			z = x
			j = i + 1
			while j < n:
				z *= a[j]
				if z > m or z > 10 ** 18:
					break
				j += 1
			if j >= n:
				return count
			count = solve(a, count, m, x, n, i + 1)
		x = y
		i += 1
	return count

def main():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	ans = solve(arr, 0, k, 1, n, 0)
	l = pow(2, n) - 1
	l -= ans
	print(l)
main()


import math
(n, k) = input().split()
n = int(n)
k = int(k)
a = list(map(int, input().split()))
helper = []
helper.append(1)
a.sort()
countones = 0
a1 = []
for i in range(n):
	if a[i] == 1:
		countones += 1
	elif a[i] > 1:
		a1.append(a[i])
for i in range(len(a1)):
	if a1[i] > k:
		continue
	le = len(helper)
	j = 0
	while j < le:
		if helper[j] * a1[i] <= k:
			helper.append(helper[j] * a1[i])
		elif helper[j] * a1[i] > k:
			break
		j += 1
	helper.sort()
answer = int((len(helper) - 1) * math.pow(2, countones) + math.pow(2, countones) - 1)
print(answer)


import functools

def ans(a, i, n, k, p, prods):
	if n == 0:
		return 0
	j = i + 1
	n = n - 1
	if p * prods[i] < k:
		return 0
	w = ans(a, j, n, k, p, prods)
	if p * a[i] >= k:
		return (1 << n) + w
	return ans(a, j, n, k, p * a[i], prods) + w
(n, k) = input().split(' ')
n = int(n)
k = int(k)
nums = input().split(' ')
a = [int(x) for x in nums]
a.sort(reverse=True)
prods = [functools.reduce(lambda x, y: x * y, a)]
for i in range(1, n):
	prods.append(prods[i - 1] / a[i - 1])
print((1 << n) - ans(a, 0, n, k, 1, prods) - 1)


v = []
b = []
ind = -1
l = list(map(int, input().split()))
n = l[0]
k = l[1]
arr = list(map(int, input().split()))

def compute(i, prod):
	if i > ind:
		return
	compute(i + 1, prod)
	v.append(prod * arr[i])
	compute(i + 1, prod * arr[i])

def solve(i, prod):
	if i == n:
		return
	solve(i + 1, prod)
	if arr[i] > k:
		return
	prod *= arr[i]
	if prod <= k:
		b.append(prod)
		solve(i + 1, prod)

def solve1(i, prod):
	if i == n:
		return 1
	ans = solve1(i + 1, prod)
	prod *= arr[i]
	if prod <= k:
		ans += solve1(i + 1, prod)
	return ans

def upperBound(a, lo, hi, x):
	if lo > hi:
		return lo
	mid = (lo + hi) // 2
	if a[mid] == x:
		return upperBound(a, mid + 1, hi, x)
	elif a[mid] > x:
		return upperBound(a, lo, mid - 1, x)
	else:
		return upperBound(a, mid + 1, hi, x)
prod = 1
for i in range(n):
	prod *= arr[i]
	if prod <= k:
		ind += 1
	else:
		break
if ind > 5:
	compute(0, 1)
	solve(ind + 1, 1)
	ans = (1 << ind + 1) - 1
	v.sort()
	for i in range(len(b)):
		if b[i] > k:
			continue
		ans += 1
		temp = k // b[i]
		up = upperBound(v, 0, len(v) - 1, temp)
		if up == len(v):
			up -= 1
		cnt = up + 1
		while up >= 0 and v[up] > temp:
			cnt -= 1
			up -= 1
		ans += cnt
else:
	ans = solve1(0, 1) - 1
print(ans)


(r, e) = input().split()
n = int(r)
val = int(e)
list = input().split()
count = 0
stuff = []
cou = 0
siu = 0
for i in list:
	u = int(i)
	if u < val and u != 1:
		stuff.insert(count, u)
		count = count + 1
	if u == 1:
		siu = siu + 1
li = len(stuff)
ui = li
li = int(li / 2)
puff = stuff[0:li]
kuff = stuff[li:ui]
vol1 = 2 ** len(puff) - 1
vol2 = 2 ** len(kuff) - 1
ans1 = []
ans2 = []
for i in range(1, vol1 + 1):
	pro = 1
	ue = 0
	for j in range(0, len(puff) + 1):
		if i & 1 << j:
			pro = pro * puff[j]
		if pro > val:
			ue = 1
			break
	if ue == 0:
		ans1.insert(0, pro)
for i in range(1, vol2 + 1):
	pro = 1
	ue = 0
	for j in range(0, len(kuff) + 1):
		if i & 1 << j:
			pro = pro * kuff[j]
		if pro > val:
			ue = 1
			break
	if ue == 0:
		ans2.insert(0, pro)
ans2.sort()
ans1.sort()
for i in range(0, len(ans1)):
	for j in range(0, len(ans2)):
		ri = ans1[i] * ans2[j]
		if ri <= val:
			cou = cou + 1
		else:
			break
ous = cou + len(ans1) + len(ans2)
an = ous
if siu >= 1:
	an = 1 + 2 * ous
if siu > 1:
	for i in range(1, siu):
		an = 1 + an * 2
print(an)


(n, k) = map(int, input().split())
d = []
s = 0
ac = 0
l = list(map(int, input().split()))
cnt1 = l.count(1)
for i in range(n):
	if i == 0 and l[i] != 1:
		if l[i] <= k:
			d.append(l[i])
			s += 1
			ac += 1
	else:
		asd = ac
		z = 0
		if l[i] <= k and l[i] != 1:
			for j in range(ac):
				x = l[i] * d[j]
				if x <= k:
					s += 1
					d.append(x)
					z += 1
			d.append(l[i])
			z += 1
			s += 1
		ac += z
s = (pow(2, cnt1) - 1) * (1 + s) + s
print(s)


def q6(nums, k, d):
	for i in range(len(nums)):
		current = nums[i]
		if current > k:
			continue
		currentDict = dict()
		for elem in d:
			new = current * elem
			if new <= k:
				currentDict[new] = d[elem]
		for elem in currentDict:
			if elem not in d:
				d[elem] = currentDict[elem]
			else:
				d[elem] += currentDict[elem]
		if current in d:
			d[current] += 1
		else:
			d[current] = 1

def main():
	line = input()
	k = line.split(' ')[1]
	nums = list(map(int, input().split(' ')))
	d = dict()
	q6(nums, int(k), d)
	counter = 0
	for p in d:
		counter += d[p]
	print(counter)
main()


g1 = []
g2 = []
r = input().split()
n = int(r[0])
k = int(r[1])
inp = [int(i) for i in input().split()]
mid = int(n / 2)
a = inp[:mid]
b = inp[mid:]

def genp(i, s):
	if i == len(a):
		if s != 0:
			g1.append(s)
	else:
		genp(i + 1, s * a[i])
		genp(i + 1, s)

def genp1(i, s):
	if i == len(b):
		if s != 0:
			g2.append(s)
	else:
		genp1(i + 1, s * b[i])
		genp1(i + 1, s)

def bin(v):
	lo = 0
	hi = len(g2) - 1
	if hi * v <= v:
		return -1
	mid = int((lo + hi) / 2)
	while lo <= hi:
		mid = int((lo + hi) / 2)
		if g2[mid] * v > k:
			if g2[mid - 1] * v <= k:
				return mid
			hi = mid
		elif g2[mid] * v <= k:
			lo = mid + 1

def count():
	g1.sort()
	g2.sort()
	ans = 0
	j = len(g2) - 1
	for i in range(len(g1)):
		if g1[i] > k:
			ans += len(g2)
			continue
		if g1[i] * g2[0] > k:
			ans += len(g2) - 1
			continue
		while j > 0 and g1[i] * g2[j] > k:
			j -= 1
		ans += len(g2) - j - 1
	return ans

def main():
	genp(0, 1)
	genp1(0, 1)
	ans = count()
	print(2 ** n - 1 - ans)
main()


import math
(n, k) = [int(i) for i in input().split()]
k = math.log(k)
c = [int(i) for i in input().split()]
a = [round(math.log(i), 10) for i in c]
b = [dict() for x in range(n)]

def find_sequence(n, s):
	if s > k:
		return 0
	if n == -1:
		return 1
	if s in b[n]:
		return b[n][s]
	else:
		b[n][s] = find_sequence(n - 1, s + a[n]) + find_sequence(n - 1, s)
		return b[n][s]
answer = find_sequence(n - 1, 0) - 1
print(answer)


def numOfSub(integers, K, product, index):
	if product > K:
		return 0
	if index == len(integers):
		return 1
	return numOfSub(integers, K, product * integers[index], index + 1) + numOfSub(integers, K, product, index + 1)

def buildStart(integers):
	result = []
	for i in range(len(integers) - 1):
		result.append((integers[i + 1:], integers[i]))
	return result

def buildCont(sets, K):
	result = []
	for i in range(len(sets)):
		for j in range(len(sets[i][0])):
			if sets[i][0][j] * sets[i][1] <= K:
				result.append((sets[i][0][:j] + sets[i][0][j + 1:], sets[i][0][j] * sets[i][1]))
	return result

def solve(integers, K):
	result = buildStart(integers)
	counter = len(result) + 1
	while len(result) > 0:
		result = buildCont(result, K)
		counter += len(result)
	return counter

def solve3(integers, K):
	helper = {}
	for i in integers:
		tmp = {}
		for j in helper:
			if j * i <= K:
				tmp[i * j] = helper[j]
		for j in tmp:
			if j in helper:
				helper[j] += tmp[j]
			else:
				helper[j] = tmp[j]
		if i not in helper:
			helper[i] = 0
		helper[i] += 1
	result = 0
	for j in helper:
		result += helper[j]
	return result
(N, K) = input().split(' ')
(N, K) = (int(N), int(K))
arrStr = input().split(' ')
integers = [int(a) for a in arrStr if int(a) <= K]
print(solve3(integers, K))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
m = {}
m[a[0]] = 1
for i in range(1, n):
	m_temp = m.copy()
	if a[i] in m_temp.keys():
		m_temp[a[i]] = m_temp[a[i]] + 1
	else:
		m_temp[a[i]] = 1
	for j in m:
		if j * a[i] > k:
			continue
		if j * a[i] in m_temp.keys():
			m_temp[j * a[i]] += m[j]
		else:
			m_temp[j * a[i]] = m[j]
	m = m_temp
ans = 0
for j in m:
	if j > k:
		continue
	ans += m[j]
print(ans)


from bisect import bisect_right
(A, B) = ([], [])
(prodA, prodB) = ([], [])
S = []
(N, P) = map(int, input().split())
M = N - N // 2
N -= M
arr = list(map(int, input().split()))
for i in range(N):
	A.append(arr[i])
for i in range(M):
	B.append(arr[N + i])

def get_productsA(pos, prod, tak):
	if pos == N:
		if tak == False:
			return
		prodA.append(prod)
		return
	get_productsA(pos + 1, prod, tak)
	if A[pos] * prod <= P:
		get_productsA(pos + 1, prod * A[pos], True)

def get_productsB(pos, prod, tak):
	if pos == M:
		if tak == False:
			return
		prodB.append(prod)
		return
	get_productsB(pos + 1, prod, tak)
	if B[pos] * prod <= P:
		get_productsB(pos + 1, prod * B[pos], True)
get_productsA(0, 1, 0)
get_productsB(0, 1, 0)
rval = 0
prodA.sort()
S.append((0, 0))
for val in prodA:
	if val == S[-1][0]:
		temp = S.pop()
		S.append((temp[0], temp[1] + 1))
	else:
		S.append((val, S[-1][1] + 1))
rval = len(prodA) + len(prodB)
for val in prodB:
	if P // val >= S[-1][0]:
		rval += S[-1][1]
	else:
		ii = bisect_right(S, (P // val, 0))
		if S[ii][0] > P // val:
			ii -= 1
		rval += S[ii][1]
print(rval)


(N, K) = list(map(int, input().strip().split(' ')))
A = list(map(int, input().strip().split(' ')))
A = sorted(A)
total = {}
for i in range(N):
	if len(total) == 0:
		if A[i] <= K:
			total[A[i]] = 1
	else:
		L = len(total)
		if A[i] <= K:
			TT = {}
			for x in total:
				TT[x] = total[x]
			for x in TT:
				temp = x * A[i]
				if temp <= K:
					if temp in total:
						total[temp] += TT[x]
					else:
						total[temp] = TT[x]
			if A[i] in total:
				total[A[i]] += 1
			else:
				total[A[i]] = 1
		else:
			break
SUM = 0
for x in total:
	SUM += total[x]
print(SUM)


import sys

def solve(A, n, k):
	if n == 1:
		return {A[0]: 1}
	h = solve(A, n - 1, k)
	hNew = {}
	for x in h:
		hNew[x] = h[x]
	for x in h:
		temp = x * A[n - 1]
		if temp <= k:
			if not temp in hNew:
				hNew[temp] = 0
			hNew[temp] += h[x]
	if not A[n - 1] in hNew:
		hNew[A[n - 1]] = 0
	hNew[A[n - 1]] += 1
	return hNew
(n, k) = map(int, input().split())
A = [x for x in list(map(int, input().split())) if x <= k]
n = min(n, len(A))
if n == 0:
	print(0)
else:
	h = solve(A, n, k)
	print(sum(h.values()))


(n, k) = list(map(int, input().split()))
ar = list(map(int, input().split()))

def proc(l, r):
	prod = []
	sz = r - l
	for mask in range(1, 1 << sz):
		res = 1
		for i in range(l, r):
			if mask & 1 << i - l:
				res *= ar[i]
		prod.append(res)
	prod.sort()
	return prod
(left, right) = (list(reversed(proc(0, n // 2))), proc(n // 2, n))
ans = 0
for it in left:
	if it <= k:
		ans += 1
for it in right:
	if it <= k:
		ans += 1
j = 0
for i in range(len(left)):
	while j < len(right) and left[i] * right[j] <= k:
		j += 1
	ans += j
print(ans)


import bisect
(n, k) = map(int, input().split(' '))
line = input()
arr = list(map(int, line.split(' ')))
part1 = int(n / 2)
part2 = n - part1
arr1 = []
arr2 = []
for i in range(0, part1):
	arr1.append(arr[i])
for i in range(part1, n):
	arr2.append(arr[i])
sz1 = 1 << part1
sz2 = 1 << part2
set_part1 = []
set_part2 = []
for i in range(1, sz1):
	mul = 1
	for j in range(0, part1):
		if i & 1 << j != 0:
			mul = mul * arr1[j]
	if mul <= k:
		set_part1.append(mul)
for i in range(1, sz2):
	mul = 1
	for j in range(0, part2):
		if i & 1 << j != 0:
			mul = mul * arr2[j]
	if mul <= k:
		set_part2.append(mul)
set_part1.sort()
set_part2.sort()
l = len(set_part1)
ans = len(set_part1) + len(set_part2)
for i in range(0, l):
	ind = bisect.bisect_right(set_part2, int(k / set_part1[i]))
	ans = ans + ind
print(ans)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
n1 = n // 2
n2 = n - n1
sa = []
sb = []
x = []
y = []

def binarySearch(req):
	l = 0
	h = len(y) - 1
	while l <= h:
		mid = (l + h) // 2
		if y[mid] == req:
			l = mid + 1
		elif y[mid] < req:
			l = mid + 1
		else:
			h = mid - 1
	return l
for i in range(0, n1):
	sa.append(a[i])
for i in range(n1, n):
	sb.append(a[i])
for i in range(1, 2 ** n1):
	r = 1
	for j in range(0, n1):
		if i & 2 ** j:
			r = r * sa[j]
	x.append(r)
for i in range(1, 2 ** n2):
	r = 1
	for j in range(0, n2):
		if i & 2 ** j:
			r = r * sb[j]
	y.append(r)
res = 0
x.sort()
y.sort()
for i in x:
	if i <= k:
		res += 1
	else:
		break
for i in y:
	if i <= k:
		res += 1
	else:
		break
for i in range(len(x)):
	req = k // x[i]
	ans = binarySearch(req)
	res += ans
print(res)


(N, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
lA = []
lB = []

def recA(i, chosen, n, mul, k):
	if i == n:
		if mul <= k and chosen != 0:
			lA.append(mul)
		return
	recA(i + 1, chosen + 1, n, mul * a[i], k)
	recA(i + 1, chosen, n, mul, k)

def recB(i, chosen, n, mul, k):
	if i == n:
		if mul <= k and chosen != 0:
			lB.append(mul)
		return
	recB(i + 1, chosen + 1, n, mul * a[i], k)
	recB(i + 1, chosen, n, mul, k)

def bsearch(aa, k):
	l = 0
	r = len(lB)
	b = k // aa
	while l < r:
		mid = (l + r) // 2
		if lB[mid] > b:
			r = mid
		elif lB[mid] < b:
			l = mid + 1
		else:
			l = mid + 1
	return r
recA(0, 0, N // 2, 1, k)
recB(N // 2, 0, N, 1, k)
lA.sort()
lB.sort()
res = 0
for i in lA:
	if i <= k:
		res += 1
for i in lB:
	if i <= k:
		res += 1
for i in lA:
	res += bsearch(i, k)
print(res)


(n, k) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
l1 = [1]
l2 = [1]

def get_possibilities(no):
	start = 0
	l2_len = len(l2)
	end = l2_len - 1
	if l2[end] * no <= k:
		return l2_len
	while start <= end:
		mid = (start + end) // 2
		if mid == l2_len - 1:
			return 0
		elif l2[mid] * no <= k and l2[mid + 1] * no > k:
			return mid + 1
		elif l2[mid] * no <= k:
			start = mid + 1
		else:
			end = mid - 1
	return 0
for i in arr[:n // 2]:
	l1_len = len(l1)
	for j in l1[:l1_len]:
		if i * j <= k:
			l1.append(i * j)
for i in arr[n // 2:]:
	l2_len = len(l2)
	for j in l2[:l2_len]:
		if i * j <= k:
			l2.append(i * j)
l2.sort()
ans = -1
for i in l1:
	ans += get_possibilities(i)
print(ans)


from copy import deepcopy
[n, k] = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
s = {}
for ii in a:
	if ii >= k:
		break
	d = []
	for j in s:
		if j * ii <= k:
			d.append([ii * j, s[j]])
	if ii in s:
		s[ii] += 1
	else:
		s[ii] = 1
	for i in d:
		if i[0] in s:
			s[i[0]] += 1 * i[1]
		else:
			s[i[0]] = i[1]
ans = 0
for i in s:
	ans += s[i]
print(ans)


a = list(map(int, input().split(' ')))
n = a[0]
k = a[1]
a = list(map(int, input().split(' ')))
a1 = []
a2 = []
for i in range(len(a) // 2):
	a1.append(a[i])
for i in range(len(a) // 2, len(a)):
	a2.append(a[i])
p1 = []
p2 = []
for i in range(1, 1 << len(a1)):
	pro = 1
	for j in range(len(a1)):
		if i >> j & 1 == 1:
			pro = pro * a1[j]
	if pro <= k:
		p1.append(pro)
for i in range(1, 1 << len(a2)):
	pro = 1
	for j in range(len(a2)):
		if i >> j & 1 == 1:
			pro = pro * a2[j]
	if pro <= k:
		p2.append(pro)
ans = 0
p1.sort()
p2.sort()
ans = ans + len(p1) + len(p2)
ind2 = 0
p1.reverse()
for i in p1:
	while ind2 < len(p2) and i * p2[ind2] <= k:
		ind2 = ind2 + 1
	ans = ans + ind2
print(ans)


from collections import defaultdict
(N, K) = map(int, input().split())
nums = list((int(token) for token in input().split()))
nums.sort()

def simple_sol():
	ones = sum((num == 1 for num in nums))
	nonones = nums[ones:]
	s = defaultdict(int)
	s[1] = 2 ** ones
	for num in nonones:
		for (key, value) in list(s.items()):
			nkey = key * num
			if nkey <= K:
				s[nkey] += value
	return sum(s.values()) - 1
print(simple_sol())


lis = input().split()
n = int(lis[0])
k = int(lis[1])
lis = input().split()
Array = []
for i in range(0, n):
	Array.append(int(lis[i]))
X = []
Y = []
for i in range(0, 1 << int(n / 2)):
	result = 1
	for j in range(0, int(n / 2)):
		if i & 1 << j:
			result = result * Array[j]
	X.append(result)
for i in range(0, 1 << n - int(n / 2)):
	result = 1
	for j in range(0, n - int(n / 2)):
		if i & 1 << j:
			result = result * Array[j + int(n / 2)]
	Y.append(result)
szx = 1 << int(n / 2)
szy = 1 << n - int(n / 2)
Y.sort()
Count = 0
X[0] = 1
Y[0] = 1
for i in range(0, szx):
	low = 0
	high = szy
	p = 0
	while low < high:
		mid = int((low + high) / 2)
		if Y[mid] <= k / X[i]:
			p = mid
			low = mid + 1
		else:
			high = mid - 1
	if p < szy - 1:
		p = p + 1
	if p == szy:
		p = p - 1
	while Y[p] * X[i] > k and p >= 0:
		p = p - 1
	if p == -1:
		continue
	if Y[p] * X[i] <= k:
		Count = Count + (p + 1)
print(Count - 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))

def f(i, p):
	if p > k:
		return 0
	if i == -1:
		return 1
	if p not in dp[i]:
		dp[i][p] = f(i - 1, p) + f(i - 1, p * a[i])
	return dp[i][p]
dp = [{} for i in range(n)]
ans = f(n - 1, 1) - 1
print(ans)


def solve(A, aa, k):
	A.sort()
	for i in range(1, 2 ** len(A)):
		mul = 1
		for j in range(0, len(A)):
			if 2 ** j & i:
				mul = mul * A[j]
		if mul <= k:
			aa.append(mul)
	aa.sort()
(N, K) = map(int, input().split())
Arr = [int(x) for x in input().split()]
A = list()
B = list()
for i in range(1, N + 1):
	if 2 * i <= N:
		A.append(Arr[i - 1])
	else:
		B.append(Arr[i - 1])
aa = list()
bb = list()
solve(A, aa, K)
solve(B, bb, K)
result = len(aa) + len(bb)
for i in range(0, len(aa)):
	b = 0
	e = len(bb) - 1
	idx = -1
	while b <= e:
		mi = (b + e) // 2
		if aa[i] * bb[mi] <= K:
			idx = mi
			b = mi + 1
		else:
			e = mi - 1
	result += idx + 1
print(result)


from sys import stdin
from _bisect import bisect_right

def line():
	return stdin.readline().strip()

def solve(V):
	ans = []
	_len = len(V)
	for mask in range(1, 1 << _len):
		_ans = 1
		for j in range(_len):
			if mask & 1 << j:
				_ans *= V[j]
		ans.append(_ans)
	return ans
(N, K) = map(int, line().split())
L = list(map(int, line().split()))
a = solve(L[:N // 2])
b = solve(L[N // 2:])
ans = 0
a = sorted(a)
for i in b:
	temp = K // i
	_s = bisect_right(a, temp)
	ans += _s
b = sorted(b)
ans += bisect_right(a, K)
ans += bisect_right(b, K)
print(ans)