A basketball competition is held where the number of players in a team does not have a maximum or minimum limit (not necessarily $5$ players in one team for each match). There are $N$ candidate players in the competition that will be trained by Pak Chanek, the best basketball coach on earth. The $i$-th candidate player has a power of $P_i$.

Pak Chanek will form zero or more teams from the $N$ candidate players on the condition that each candidate player may only join in at most one team. Each of Pak Chanek's teams will be sent to compete once with an enemy team that has a power of $D$. In each match, the team sent is said to defeat the enemy team if the sum of powers from the formed players is strictly greater than $D$.

One of Pak Chanek's skills is that when a team that has been formed plays in a match, he can change the power of each player in the team to be equal to the biggest player power from the team.

Determine the maximum number of wins that can be achieved by Pak Chanek.


-----Input-----

The first line contains two integers $N$ and $D$ ($1 \le N \le 10^5$, $1 \le D \le 10^9$) — the number of candidate players and the power of the enemy team.

The second line contains $N$ integers $P_1, P_2, \ldots, P_N$ ($1 \le P_i \le 10^9$) — the powers of all candidate players.


-----Output-----

A line containing an integer representing the maximum number of wins that can be achieved by Pak Chanek.


-----Examples-----

Input
6 180
90 80 70 60 50 100
Output
2


-----Note-----

The $1$-st team formed is a team containing players $4$ and $6$. The power of each player in the team becomes $100$. So the total power of the team is $100 + 100 = 200 > 180$.

The $2$-nd team formed is a team containing players $1$, $2$, and $5$. The power of each player in the team becomes $90$. So the total power of the team is $90 + 90 + 90 = 270 > 180$.

Source: codeforces | Difficulty: EASY
Tags: Sorting

Greedy algorithms


Solutions:
def solve():
	(n, d) = map(int, input().split())
	a = sorted([*map(int, input().split())])[::-1]
	(i, j, r) = (0, len(a), 0)
	while i < j:
		x = a[i]
		while x <= d:
			j -= 1
			if i < j:
				x += a[i]
			else:
				return r
		else:
			r += 1
			i += 1
	return r
print(solve())


(n, d) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]

def cal(n, d, arr):
	arr.sort(reverse=True)
	t = 0
	ans = 0
	for i in range(n):
		if i <= n - t - 1:
			p = d // arr[i]
			if i + 1 + p <= n - t:
				ans += 1
				t += p
			else:
				break
		else:
			break
	return ans
print(cal(n, d, arr))


(n, d) = map(int, input().split())
powers = sorted(map(int, input().split()), reverse=True)
wins = 0
for power in powers:
	req = d // power + 1
	n -= req
	if n >= 0:
		wins += 1
	else:
		break
print(wins)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
c = 0
for i in range(n):
	x = d // l[i] + 1
	n = n - x
	if n >= 0:
		c = c + 1
	else:
		break
print(c)


from collections import deque
(N, M) = input().split(' ')
N = int(N)
M = int(M)
powers = [int(i) for i in input().split(' ')]
powers.sort()
q = deque(powers)
c = 0
while q:
	curr = q.pop()
	org = curr
	while curr <= M and q:
		q.popleft()
		curr += org
	if curr > M:
		c += 1
print(c)


(n, d) = map(int, input().split())
p = list(map(int, input().split()))
p.sort(reverse=True)
c = 0
a = 0
for i in range(n):
	c = c + d // p[i] + 1
	if c <= n:
		a = a + 1
	else:
		break
print(a)


(n, x) = map(int, input().split())
l = [int(a) for a in input().split()]
l.sort(reverse=True)
c = 0
i = 0
v = l[i]
t = 0
(ans, curr) = (0, 0)
for i in l:
	curr += x // i + 1
	if curr > n:
		break
	ans += 1
print(ans)


(n, x) = map(int, input().split())
l = [int(a) for a in input().split()]
l.sort(reverse=True)
c = 0
i = 0
v = 0
t = 0
while n:
	v += l[i]
	if v > x:
		c += 1
		i += 1
		v = 0
	n -= 1
print(c)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
c = 0
ans = 0
for i in range(n):
	c = c + (m // l[i] + 1)
	if c <= n:
		ans = ans + 1
	else:
		break
print(ans)


import sys
import math
from collections import Counter

def gi():
	return list(map(int, sys.stdin.readline().strip().split()))

def gs():
	return sys.stdin.readline().strip()

def fun(ep, a):
	a.sort()
	if min(a) > ep:
		return len(a)
	l = len(a)
	j = l - 1
	i = -1
	s = a[j]
	c = 0
	while i < j:
		if s > ep:
			c += 1
			j -= 1
			if i < j:
				s = a[j]
			else:
				s = -1
		else:
			i += 1
			if i < j:
				s += a[j]
			else:
				s = -1
	if s > ep:
		c += 1
	return c
for _ in range(1):
	p = gi()
	a = gi()
	print(fun(p[-1], a))


(N, D) = list(map(int, input().split()))
p = [int(i) for i in input().split()]
p.sort()
p.reverse()
ans = 0
r = N - 1
for l in range(N):
	mem = D // p[l]
	r -= mem
	if r >= l:
		ans += 1
	else:
		break
print(ans)


def R():
	return [*map(int, input().split())]
(n, d) = R()
a = R()
a = sorted(a)
ans = 0
j = 0
for i in range(n - 1, -1, -1):
	r = d // a[i]
	if r <= i - j:
		ans += 1
		j += r
	else:
		break
print(ans)


inputs = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = 0
cursum = 0
(l, r) = (0, inputs[0] - 1)
a.sort()
cursum = 0
while l <= r:
	cursum += a[r]
	while l <= r and cursum > inputs[1]:
		cnt += 1
		r -= 1
		cursum = a[r]
	l += 1
print(cnt)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
cnt = 0
count = len(l)
for i in l:
	x = d // i + 1
	if count - x < 0:
		break
	count -= x
	cnt += 1
print(cnt)


(n, d) = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
x.sort(reverse=True)
s = 0
a = 0
for i in x:
	s += d // i + 1
	if s > n:
		break
	a += 1
print(a)


(n, d) = list(map(int, input().split()))
k = list(map(int, input().split()))
k.sort(reverse=True)
count = 0
remain = n
while True:
	use = d // k[count] + 1
	if use > remain:
		print(count)
		break
	remain = remain - use
	count = count + 1
	if remain == 0:
		print(count)
		break


(n, d) = map(int, input().split())
p = list(map(int, input().split(' ')))
p.sort(reverse=True)
total = 0
c = 0
for i in p:
	number = d // i + 1
	total += number
	if total > n:
		break
	else:
		c += 1
print(c)


(n, enemyPower) = map(int, input().split())
playerStrength = list(map(int, input().split()))
playerStrength.sort()
left = 0
right = n - 1
teamStrength = 0
ans = 0
while left <= right:
	teamStrength += playerStrength[right]
	if teamStrength > enemyPower:
		ans += 1
		right -= 1
		teamStrength = 0
	else:
		left += 1
print(ans)


d = int(input().split(' ')[1])
p = sorted(map(int, input().split(' ')))
c = 0
l = 0
r = len(p) - 1
s = p[r]
while r > l:
	while s <= d:
		s += p[r]
		l += 1
	if l > r:
		break
	r -= 1
	s = p[r]
	c += 1
if p[0] > d:
	c += 1
print(c)


(N, D) = [int(i) for i in input().split()]
list = [int(i) for i in input().split()]
list.sort(reverse=True)
players = 0
count = 0
for i in list:
	players += D // i + 1
	if players > N:
		break
	count += 1
print(count)


(N, D) = map(int, input().split())
P = list(map(int, input().split()))
P.sort(reverse=True)
cnt = 0
total = 0
for i in P:
	need = (D + i) // i
	total += need
	if total <= N:
		cnt += 1
print(cnt)


import sys
nd = [int(ii) for ii in input().split()]
(n, d) = (nd[0], nd[1])
p = [int(ii) for ii in input().split()]
p.sort(reverse=True)
(i, ans) = (0, 0)
while n > 0:
	n -= d // p[i] + 1
	if n < 0:
		break
	ans += 1
	i += 1
print(ans)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
a = 0
s = 0
l.sort(reverse=True)
for i in l:
	s += d // i + 1
	if s > n:
		break
	else:
		a += 1
print(a)


import math
from collections import *

def solve():
	(n, d) = map(int, input().split())
	a = [int(i) for i in input().split()]
	a.sort(reverse=True)
	i = 0
	t = n
	c = 0
	while t > 0:
		l = d // a[i] + 1
		if t >= l:
			t -= l
			i += 1
			c += 1
		else:
			break
	print(c)
solve()


from math import floor

def main():
	(n, d) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	diff = floor(d / arr[0]) + 1
	count = 0
	i = 1
	length = n
	while n >= diff:
		count += 1
		n = n - diff
		if i < length:
			diff = floor(d / arr[i]) + 1
			i += 1
		else:
			break
	print(count)
main()


(n, d) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
(ptr1, ptr2) = (0, n - 1)
(cur_power, answer) = (0, 0)
while ptr2 >= ptr1:
	cur_power = arr[ptr2]
	while cur_power <= d and ptr1 < ptr2:
		ptr1 += 1
		cur_power += arr[ptr2]
	if cur_power > d:
		answer += 1
	ptr2 -= 1
print(answer)


class Solution:

	def basketballTogether(self, n, d, ps):
		ps.sort(reverse=True)
		(sum_, count) = (0, 0)
		for pi in ps:
			need = (d + pi) // pi
			sum_ += need
			if sum_ > n:
				return count
			else:
				count += 1
		return count
sol = Solution()
(n, d) = list(map(int, input().split()))
ps = list(map(int, input().split()))
print(sol.basketballTogether(n, d, ps))


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
players = len(l)
l.sort(reverse=True)
counter = 0
for i in l:
	needed = d // i + 1
	if players >= needed:
		players = players - needed
		counter += 1
	else:
		break
print(counter)


def fn(l1, l2):
	if l1[0] == 1:
		return int(l2[0] > l1[1])
	l2.sort()
	i = 0
	j = l1[0] - 1
	cnt = 0
	while 1:
		if i == j:
			if l2[i] > l1[1]:
				cnt += 1
			break
		req = l1[1] // l2[j]
		if i + req - 1 < j:
			cnt += 1
			i += req
			j -= 1
		else:
			break
	return cnt
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
print(fn(l1, l2))


(n, d) = map(int, input().split())
koroshite = sorted(list(map(int, input().split())))
ans = 0
kk = len(koroshite)
indexer = -1
while kk > 0:
	ageru = d // koroshite[indexer] + 1
	if ageru > kk:
		break
	else:
		kk -= ageru
		ans += 1
		indexer -= 1
print(ans)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
i = ans = sm = 0
while n:
	sm += a[i]
	if sm > m:
		ans += 1
		i += 1
		sm = 0
	n -= 1
print(ans)


(n, d) = map(int, input().split())
players = list(map(int, input().split()))
players.sort(reverse=True)
i = 0
j = len(players) - 1
result = 0
while i <= j:
	if i == j:
		if players[i] > d:
			result += 1
		break
	num = d // players[i]
	if num == 0:
		result += 1
		i += 1
		continue
	j = j - num
	if j < i:
		break
	i += 1
	result += 1
print(result)


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

def li():
	return list(map(int, sys.stdin.readline().split()))

def mp():
	return map(int, sys.stdin.readline().split())

def inp():
	return int(sys.stdin.readline())

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, x) = mp()
l = li()
l.sort(reverse=True)
i = 0
k = 0
c = 0
while k < n:
	r = x // l[i] + 1
	if r <= n - k:
		c += 1
		k += r
		i += 1
	else:
		break
pr(c)


(n, d) = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
num_of_players = 1
r = n - 1
l = 0
win = 0
while l + num_of_players - 1 <= r and num_of_players <= n:
	if p[r] * num_of_players <= d:
		num_of_players = num_of_players + 1
	else:
		r = r - 1
		l = l + num_of_players - 1
		win = win + 1
print(win)


(n, d) = map(int, input().split())
p = list(map(int, input().split()))
p.sort(reverse=True)
(cnt, ans) = (len(p), 0)
for e in p:
	if cnt >= d // e + 1:
		cnt -= d // e + 1
		ans += 1
	else:
		break
print(ans)


(n, k) = list(map(int, input().split(sep=' ')))
arr = list(map(int, input().split(sep=' ')))
arr.sort()
cnt = 0
s = 0
i = -1
while s < n:
	s += k // arr[i] + 1
	i = i - 1
	cnt = cnt + 1
if s > n:
	print(cnt - 1)
elif s == n:
	print(cnt)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
(l, r) = (0, len(arr) - 1)
cnt = 0
arr.sort()
sm = 0
while l <= r:
	sm += arr[r]
	if sm > m:
		sm = 0
		cnt += 1
		r -= 1
	else:
		l += 1
print(cnt)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
r = 0
l = n
for i in range(n):
	r = d // a[i] + 1
	if r <= l:
		l -= r
		ans += 1
	else:
		break
print(ans)


(n, d) = map(int, input().split())
p_arr = list(map(int, input().split()))
win_s = 0
team = []
p_arr.sort()
(i, j) = (0, len(p_arr) - 1)
while i <= j:
	sum_ = p_arr[j]
	while sum_ <= d and i < j:
		sum_ += p_arr[j]
		i += 1
	if sum_ > d:
		win_s += 1
	j -= 1
print(win_s)


import sys
(n, m) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
a.sort()
nn = 0
ans = 0
for i in range(n - 1, -1, -1):
	k = m // a[i] + 1
	nn += k
	if nn <= n:
		ans += 1
	else:
		break
print(ans)


import sys

def input(type=str):
	return type(sys.stdin.readline().strip())

def input_n(type=str):
	return list(map(type, input().split()))
(N, D) = input_n(int)
P = input_n(int)
P.sort()
left = 0
right = N - 1
win_cnt = 0
while True:
	left += D // P[right] + 1 - 1
	right -= 1
	if left - right > 1:
		break
	win_cnt += 1
print(win_cnt)


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
ans = 0
ind = n - 1
arr.sort()
while n > 0:
	t = d // arr[ind] + 1
	if t <= n:
		n -= t
		ans += 1
	else:
		break
	ind -= 1
print(ans)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
(i, j) = (-1, n - 1)
c = 1
ans = 0
while i < j:
	if l[j] * c > d:
		ans += 1
		j -= 1
		c = 1
	else:
		i += 1
		c += 1
print(ans)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
(i, j) = (0, n - 1)
ans = 0
while i <= j:
	k = d // a[j] + 1
	if i + k - 1 <= j:
		ans += 1
		j -= 1
		i += k - 1
	else:
		break
print(ans)


def basketball():
	(n, m) = map(int, input().split())
	team = list(map(int, input().split()))
	team.sort()
	k = 1
	ans = 0
	index = 0
	sep_1 = n
	while k != 0:
		i = m // team[n - 1 - index] + 1
		if i * team[n - 1 - index] > m and i <= sep_1:
			sep_1 = sep_1 - i
			ans = ans + 1
		else:
			break
		index = index + 1
	print(ans)
basketball()


from math import ceil
(n, d) = list(map(int, input().split(' ')))
p = list(map(int, input().split(' ')))
p.sort(reverse=True)
count = 0
if min(p) > d:
	print(n)
else:
	for i in p:
		need = ceil((d + 1) / i)
		count += 1
		n -= need
		if n < 0:
			print(count - 1)
			break


(n, d) = [int(i) for i in input().split()]
plis = [int(j) for j in input().split()]
plis = sorted(plis)
win = 0
while n > 0:
	n -= d // int(plis[-1]) + 1
	if n >= 0:
		win += 1
		del plis[-1]
	else:
		break
print(win)


(n, d) = map(int, input().split())
s = list(map(int, input().split()))
k = n
r = -1
s.sort()
while k - d // s[r] - 1 >= 0:
	k -= d // s[r] + 1
	r -= 1
	if r < -n:
		break
print(-1 - r)


import math
(N, d) = map(int, input().split())
players = sorted(map(int, input().split()), reverse=True)
win = 0
for player in players:
	c = math.ceil((d + 1) / player)
	if c <= N:
		win += 1
		N -= c
	else:
		break
print(win)


def bas_togeather():
	from math import ceil
	(n, d) = map(int, input().split())
	p = list(map(int, input().split()))
	rest = n
	i = 0
	p = sorted(p, reverse=True)
	games = 0
	while i < n and p[i] * rest / d > 1:
		rest -= int(d / p[i]) + 1
		i += 1
		games += 1
	print(games)
bas_togeather()


(n, D) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
i = 0
j = n - 1
count = 0
while i <= j:
	k = D // a[j] + 1
	if i + k - 1 <= j:
		count += 1
		j -= 1
		i += k - 1
	else:
		break
print(count)


(n, d) = map(int, input().split())
p = list(map(int, input().split()))
p = sorted(p)[::-1]
i = 0
ans = 0
result = 0
while ans <= n and i < n:
	if p[i] > d:
		ans += 1
		if ans <= n:
			result += 1
		i += 1
	else:
		ans += d // p[i] + 1
		i += 1
		if ans <= n:
			result += 1
		else:
			break
print(result)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
(i, j) = (0, n - 1)
ans = 0
while i <= j:
	sum = a[j]
	while sum <= d and i < j:
		sum += a[j]
		i += 1
	if sum > d:
		ans += 1
	j -= 1
print(ans)


(n, d) = input().split()
(n, d) = (int(n), int(d))
pp = input().split()
p = []
for i in pp:
	p.append(int(i))
p.sort(reverse=True)
jug_usa = 0
for i in range(n):
	jug_nec = d // p[i] + 1
	jug_usa += jug_nec
	if jug_usa > n:
		break
if jug_usa == n:
	i += 1
print(i)


(n, d) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
ansi = 0
i = 0
length = n - 1
while i <= length:
	x = d // l[i]
	x += 1
	length = length - (x - 1)
	if length < i:
		break
	ansi += 1
	i += 1
print(ansi)


(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
(c, w) = (0, 0)
for i in range(n):
	player_need = (d + arr[i]) // arr[i]
	c += player_need
	if c > n:
		print(w)
		exit(0)
	else:
		w += 1
print(w)


(N, D) = input().split()
N = int(N)
D = int(D)
candidates = [int(x) for x in input().split()]
candidates.sort()
ans = 0
while N > 0:
	best = candidates.pop()
	c_needed = D // best + 1
	N -= c_needed
	if N >= 0:
		ans += 1
print(ans)


nd = input().split()
(n, d) = (int(nd[0]), int(nd[1]))
p = [int(x) for x in input().split()]
p.sort()
(l, r) = (0, n - 1)
cnt = 0
while l <= r:
	if p[r] > d:
		cnt += 1
		r -= 1
	else:
		m = (d + 1) // p[r] + (1 if (d + 1) % p[r] > 0 else 0)
		r -= 1
		l += m - 1
		if l <= r + 1:
			cnt += 1
print(cnt)


(b, c) = map(int, input().split())
d = [int(x) for x in input().split()]
d.sort(reverse=True)
e = 0
wins = 0
for ele in d:
	e += c // ele + 1
	if e > b:
		break
	wins += 1
print(wins)


(N, D) = map(int, input().split())
powers = list(map(int, input().split()))
powers.sort()
left = 0
right = N - 1
count = 0
while True:
	times = D // powers[right]
	times += 1
	if right - left + 1 >= times:
		left += times - 1
		count += 1
		right -= 1
	else:
		break
print(count)


import math
(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
i = len(arr) - 1
ans = 0
peple = len(arr)
while True:
	temp = d // arr[i] + 1
	if peple >= temp:
		peple -= temp
		i -= 1
		ans += 1
	else:
		break
print(ans)


import math
(n, d) = map(int, input().split())
powers = list(map(int, input().split()))
count = 0
(left, right) = (0, n - 1)
powers.sort()
while left <= right:
	curr = powers[right]
	while curr <= d and left != right:
		curr += powers[right]
		left += 1
	right -= 1
	if curr > d:
		count += 1
print(count)


infor = input().split()
nums = int(infor[0])
enemy = int(infor[1])
lists = input().split()
for x in range(len(lists)):
	lists[x] = int(lists[x])
lists.sort()
front = 0
answer = 0
for x in range(len(lists) - 1, -1, -1):
	need = int(enemy / lists[x])
	if x - need < front:
		break
	front += need
	answer += 1
print(answer)


(n, d) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
arr.sort()
i = 0
j = n - 1
count = 0
while i <= j:
	number = int(d / arr[j]) + 1
	if i == j and number == 1:
		count += 1
		break
	i += number - 1
	if i <= j:
		count += 1
	j -= 1
print(count)


(n, d) = map(int, input().split())
ans = 0
i = 0
pw = 0
a = sorted(map(int, input().split()), reverse=True)
while n:
	pw += a[i]
	if pw > d:
		ans += 1
		i += 1
		pw = 0
	n -= 1
print(ans)


import math
(n, d) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
k = 0
teams = 0
for i in a:
	if d % i == 0:
		k += d // i + 1
	else:
		k += math.ceil(d / i)
	if k > n:
		break
	teams += 1
print(teams)


import math
(n, d) = map(int, input().split())
p = list(map(int, input().split()))
p.sort(reverse=True)
ans = 0
boo = 0
for i in p:
	x = (d + i) // i
	boo += x
	if boo <= n:
		ans += 1
print(ans)


(n, d) = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
(i, j) = (0, n - 1)
count = 0
while i <= j:
	k = d // p[j] + 1
	if j - i + 1 < k:
		break
	else:
		count += 1
		i += k - 1
		j -= 1
print(count)


inp = list(map(int, input().split()))
n = inp[0]
d = inp[1]
p = list(map(int, input().split()))
p.sort(reverse=True)
ind = 0
left = n
win = 0
for i in range(1, n + 1):
	while True:
		if left - i < 0 or ind > n - 1:
			break
		if p[ind] * i > d:
			ind += 1
			left -= i
			win += 1
		else:
			break
	if left - i < 0:
		break
print(win)


(n, t) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
l = 0
r = n - 1
ans = 0
while l <= r:
	need = t // a[r]
	if l + need > r:
		break
	l += need
	r -= 1
	ans += 1
print(ans)


(N, D) = map(int, input().split())
p = list(map(int, input().split()))
p = sorted(p)[::-1]
i = 0
j = N - 1
count = 0
while i <= j:
	c = D // p[i]
	c = c + 1
	if c <= j - i + 1:
		count += 1
		i += 1
		j = j - c + 1
	else:
		break
print(count)


from math import ceil
(n, d) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
ct = 0
mem = n
for i in range(n):
	x = ceil(d / l[i])
	if l[i] > d and mem >= 1:
		mem -= 1
		ct += 1
	elif l[i] == d and mem >= 2:
		mem -= 2
		ct += 1
	elif x <= mem and x * l[i] != d:
		mem -= x
		ct += 1
print(ct)


x = list(map(int, input().split()))
s = list(map(int, input().split()))
z = 0
index = len(s) - 1
r = len(s)
s.sort()
for i in range(1, x[0] + 1):
	while i <= r and s[index] * i > x[1]:
		r -= i
		index -= 1
		z += 1
print(z)


from math import ceil
(n, d) = map(int, input().split())
L = list(map(int, input().split()))
L.sort(reverse=True)
cnt = 0
total = 0
for i in L:
	num = ceil((d + 1) / i)
	if num + cnt <= n:
		cnt += num
		total += 1
	else:
		break
print(total)


import math
(n, d) = map(int, input().split())
p = list(map(int, input().split()))
p.sort(reverse=True)
last_id = len(p) - 1
cnt = 0
for (idx, pi) in enumerate(p):
	if idx > last_id:
		break
	num = math.floor(d / pi) + 1
	last_id -= num - 1
	if last_id < idx:
		break
	else:
		cnt += 1
print(cnt)


from math import ceil
(n, d) = map(int, input().split())
arr = list(map(int, input().split()))
ans = 0
arr.sort(reverse=True)
for num in arr:
	loda = d // num + 1
	if n >= loda:
		ans += 1
		n -= loda
print(ans)


(n, target) = [int(x) for x in input().split()]
players = [int(x) for x in input().split()]
solution = 0
(l, r) = (0, n - 1)
players.sort(reverse=True)
while l <= r:
	team = players[l]
	while team <= target and l < r:
		team += players[l]
		r -= 1
	if team > target:
		solution += 1
	l += 1
print(solution)


import math as m

def calc(N, P, D):
	pUsed = 0
	teams = 0
	for i in range(0, N):
		pUsed += m.ceil(D / P[i] + 1e-12)
		if pUsed > N:
			break
		teams += 1
	return teams
(N, D) = [int(item) for item in input().split()]
P = [int(item) for item in input().split()]
P.sort(reverse=True)
print(calc(N, P, D))


(n, d) = map(int, input().split())
s = sorted(list(map(int, input().split())), reverse=True)
x = 0
ans = 0
i = 0
while n > 0:
	x += s[i]
	if x > d:
		ans += 1
		x = 0
		i += 1
	n -= 1
print(ans)


import math
ND = input().split()
(N, D) = (int(ND[0]), int(ND[1]))
l = list(map(int, input().split()))
l.sort(reverse=True)
(i, j) = (0, len(l) - 1)
cnt = 0
while i <= j:
	if j - i >= D // l[i]:
		cnt += 1
		j -= D // l[i]
		i += 1
	else:
		break
print(cnt)


(n, s) = map(int, input().split())
lst = list(map(int, input().split()))
(i, j) = (0, n - 1)
lst.sort()
(cnt, sum) = (0, lst[j])
while i <= j:
	while sum <= s and i < j:
		sum += lst[j]
		i += 1
	if sum > s:
		cnt += 1
	j -= 1
	sum = lst[j]
print(cnt)


(n, d) = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
sol = [d // l[i] + 1 for i in range(n)]
final = [sol[0]]
for i in range(1, len(sol)):
	final.append(final[i - 1] + sol[i])
test = False
low = 0
high = n - 1
while low <= high and test == False:
	mid = (low + high) // 2
	if final[mid] == n:
		print(mid + 1)
		test = True
		break
	elif final[mid] < n:
		low = mid + 1
	else:
		high = mid - 1
if test == False:
	print(low)


L = list(map(int, input().split()))
N = L[0]
D = L[1]
n = list(map(int, input().split()))
n.sort()
a = 0
b = 0
for i in range(N):
	c = int(D // n[N - 1 - i]) + 1
	if N - a >= c and a < N:
		a = a + c
		b = b + 1
	else:
		break
print(b)


(m, n) = map(int, input().split())
lg = list(map(int, input().split()))
lg.sort()
count = 0
j = m - 1
while m > 0:
	g = n // lg[j]
	if lg[j] * (g + 1) > n and m >= g + 1:
		m -= g + 1
		count += 1
	else:
		break
	j -= 1
print(count)


from math import ceil

def solve():
	(n, d) = map(int, input().split())
	powers = sorted(list(map(int, input().split())), reverse=True)
	p2 = len(powers)
	p1 = 0
	cnt = 0
	while p2 > 0:
		p2 -= ceil((d - powers[p1] + 0.1) / powers[p1]) + 1
		if p2 >= 0:
			cnt += 1
		p1 += 1
	print(cnt)
solve()


x = input().split()
n = int(x[0])
d = int(x[1])
y = input().split()
for i in range(n):
	y[i] = int(y[i])
y.sort(reverse=True)
ang = n
hsl = 0
for i in range(n):
	a = d // y[i]
	if ang >= a + 1:
		ang = ang - (a + 1)
		hsl += 1
	else:
		break
print(hsl)


x = input().split()
d = int(x[1])
p = map(int, input().split())
p = sorted(p)
winteams = 0
players = int(x[0])
i = -1
pt = d // p[i] + 1
powteam = p[i] * pt
while powteam > d and pt <= players:
	pt = d // p[i] + 1
	players -= pt
	winteams += 1
	i -= 1
print(winteams)