Ivan plays an old action game called Heretic. He's stuck on one of the final levels of this game, so he needs some help with killing the monsters.

The main part of the level is a large corridor (so large and narrow that it can be represented as an infinite coordinate line). The corridor is divided into two parts; let's assume that the point $x = 0$ is where these parts meet.

The right part of the corridor is filled with $n$ monsters — for each monster, its initial coordinate $x_i$ is given (and since all monsters are in the right part, every $x_i$ is positive).

The left part of the corridor is filled with crusher traps. If some monster enters the left part of the corridor or the origin (so, its current coordinate becomes less than or equal to $0$), it gets instantly killed by a trap.

The main weapon Ivan uses to kill the monsters is the Phoenix Rod. It can launch a missile that explodes upon impact, obliterating every monster caught in the explosion and throwing all other monsters away from the epicenter. Formally, suppose that Ivan launches a missile so that it explodes in the point $c$. Then every monster is either killed by explosion or pushed away. Let some monster's current coordinate be $y$, then:

  if $c = y$, then the monster is killed;  if $y < c$, then the monster is pushed $r$ units to the left, so its current coordinate becomes $y - r$;  if $y > c$, then the monster is pushed $r$ units to the right, so its current coordinate becomes $y + r$. 

Ivan is going to kill the monsters as follows: choose some integer point $d$ and launch a missile into that point, then wait until it explodes and all the monsters which are pushed to the left part of the corridor are killed by crusher traps, then, if at least one monster is still alive, choose another integer point (probably the one that was already used) and launch a missile there, and so on.

What is the minimum number of missiles Ivan has to launch in order to kill all of the monsters? You may assume that every time Ivan fires the Phoenix Rod, he chooses the impact point optimally.

You have to answer $q$ independent queries.


-----Input-----

The first line contains one integer $q$ ($1 \le q \le 10^5$) — the number of queries.

The first line of each query contains two integers $n$ and $r$ ($1 \le n, r \le 10^5$) — the number of enemies and the distance that the enemies are thrown away from the epicenter of the explosion.

The second line of each query contains $n$ integers $x_i$ ($1 \le x_i \le 10^5$) — the initial positions of the monsters.

It is guaranteed that sum of all $n$ over all queries does not exceed $10^5$.


-----Output-----

For each query print one integer — the minimum number of shots from the Phoenix Rod required to kill all monsters.


-----Example-----
Input
2
3 2
1 3 5
4 1
5 2 3 5

Output
2
2



-----Note-----

In the first test case, Ivan acts as follows:   choose the point $3$, the first monster dies from a crusher trap at the point $-1$, the second monster dies from the explosion, the third monster is pushed to the point $7$;  choose the point $7$, the third monster dies from the explosion. 

In the second test case, Ivan acts as follows:   choose the point $5$, the first and fourth monsters die from the explosion, the second monster is pushed to the point $1$, the third monster is pushed to the point $2$;  choose the point $2$, the first monster dies from a crusher trap at the point $0$, the second monster dies from the explosion.

Difficulty: EASY

Solutions:
from math import gcd, ceil
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
inp = lambda : int(stdin.readline())
sip = lambda : stdin.readline()
mulip = lambda : map(int, stdin.readline().split())
lst = lambda : list(map(int, stdin.readline().split()))
slst = lambda : list(sip())
M = pow(10, 9) + 7
for _ in range(inp()):
	(n, r) = mulip()
	A = lst()
	A = list(set(A))
	A = sorted(A)
	(L, R, k) = (0, len(A) - 1, 1)
	r1 = r
	while L < R:
		if L - R == 1:
			k += 1
			break
		if r1 >= A[L]:
			L += 1
		else:
			R -= 1
			r1 += r
			k += 1
	print(k)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for i in range(t):
	(n, r) = map(int, input().split())
	l = list(map(int, input().split()))
	l = list(set(l))
	l.sort()
	if len(l) == 1:
		print(1)
	elif len(l) == 2:
		if l[0] <= r:
			print(1)
		else:
			print(2)
	else:
		ans = 1
		k = r
		j = len(l) - 2
		while l[j] - k > 0:
			ans += 1
			k += r
			j -= 1
			if j < 0:
				break
		print(ans)


import sys
input = lambda : sys.stdin.readline().rstrip()
q = int(input())
for _ in range(q):
	(n, r) = list(map(int, input().split()))
	arr = sorted(list(set(map(int, input().split()))), reverse=True)
	result = 0
	tt = 0
	for el in arr:
		if tt >= el:
			break
		result += 1
		tt += r
	print(result)


import sys
from collections import defaultdict as dd
from collections import deque
from fractions import Fraction as f

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def bo(i):
	return ord(i) - ord('a')
from copy import *
from bisect import *
from itertools import permutations
t = fi()
while t > 0:
	t -= 1
	(n, r) = mi()
	a = li()
	a = list(set(a))
	a.sort()
	n = len(a)
	d = [0 for i in range(n)]
	for i in range(n):
		d[i] = int(ceil(a[i] / r))
	ans = n
	for i in range(n):
		if n - i - 1 >= d[i]:
			ans = n - i - 1
		else:
			break
	print(ans)


T = int(input())
fans = []
for i in range(0, T):
	(n, r) = map(int, input().split())
	a = list(set(map(int, input().split())))
	a.sort(reverse=1)
	leng = len(a)
	ans = 0
	for j in range(0, leng):
		if a[j] - ans * r > 0:
			ans += 1
		else:
			break
	fans.append(ans)
for i in fans:
	print(i)


import sys
ans = []
for i in range(int(input())):
	(n, r) = map(int, input().split())
	data = list(set(map(int, input().split())))
	data.sort()
	ans_here = 1
	mult = 1
	pos = len(data) - 2
	while pos >= 0 and data[pos] > mult * r:
		mult += 1
		ans_here += 1
		pos -= 1
	ans.append(ans_here)
print(*ans, sep='\n')


I = lambda : map(int, input().split())
l = []
for i in range(int(input())):
	(n, r) = I()
	a = list(set(I()))
	a.sort(reverse=True)
	n = len(a)
	for i in range(n):
		if a[i] <= i * r:
			break
		elif i == n - 1:
			i = n
	l.append(str(i))
print('\n'.join(l))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr = list(set(arr))
	arr.sort(reverse=True)
	d = 0
	ans = 0
	for i in range(len(arr)):
		if arr[i] <= d:
			break
		else:
			ans += 1
			d += r
	print(ans)


import sys
input = sys.stdin.readline
for i in range(int(input())):
	(n, r) = list(map(int, input().split()))
	a = sorted(list(set(list(map(int, input().split())))), reverse=True)
	i = 0
	se = 0
	n = len(a)
	while i < n and a[i] - se > 0:
		i += 1
		se += r
	print(i)


import sys
input = sys.stdin.readline
a = int(input())
for i in range(a):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	z = list(map(int, input().split()))
	z = list(sorted(set(z)))
	l = 1
	count = 1
	while l != len(z):
		if z[-1 * (l + 1)] - l * y > 0:
			count = count + 1
			l = l + 1
		else:
			break
	if count > len(z):
		count = len(z)
	print(count)


import sys
input = sys.stdin.readline
q = int(input().strip())
for _ in range(q):
	(n, r) = map(int, input().strip().split())
	a = list(map(int, input().split()))
	s = sorted(set(a), reverse=True)
	(d, cnt) = (0, 0)
	for i in s:
		if i <= d:
			break
		d += r
		cnt += 1
	print(cnt)


t = int(input())
l = []
for i in range(t):
	(n, r) = (int(j) for j in input().split())
	s1 = list(set(map(int, input().split())))
	s1.sort()
	st = 0
	if len(s1) <= (s1[0] - 1) // r + 1:
		st = len(s1)
		l.append(str(st))
	elif n == 1:
		st = 1
		l.append(str(st))
	else:
		for k in range(0, len(s1)):
			i1 = r * (k + 1)
			j1 = s1[len(s1) - k - 2]
			if i1 >= j1:
				st = k + 1
				break
		l.append(str(st))
print('\n'.join(l))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, r) = map(int, stdin.readline().split())
	l = sorted(set(map(int, stdin.readline().split())))
	s = len(l)
	count = 0
	for i in range(s - 1, -1, -1):
		if l[i] - count * r <= 0:
			break
		count += 1
	stdout.write(str(count) + '\n')


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		(n, r) = ria()
		x = ria()
		x = sorted(list(set(x)))
		x = deque(x)
		c = 0
		while True:
			x.pop()
			c += 1
			if len(x) == 0:
				break
			z = x[-1]
			x[-1] -= c * r
			if x[-1] <= 0:
				break
		print(c)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import math

def count_shot():
	(num_enemies, r) = [int(elem) for elem in input().split(' ')]
	pos = [int(elem) for elem in input().split(' ')]
	num_shots = 0
	enemies = list(set(pos))
	enemies.sort(reverse=True)
	if enemies[0] < r:
		return 1
	left = 0
	while len(enemies) != 0:
		if len(enemies) != 0:
			if enemies[0] > left:
				enemies.pop(0)
			else:
				return num_shots
		left += r
		num_shots += 1
	return num_shots
num_queries = int(input())
answers = []
for _ in range(num_queries):
	answers.append(count_shot())
for ans in answers:
	print(ans)


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	xs = sorted(list(set(map(int, input().split()))))
	counts = [(x + r - 1) / r for x in xs][::-1]
	ans = 0
	p = 0
	while p < len(counts):
		if counts[p] < p + 1:
			ans = p
			break
		p += 1
	if p == len(counts):
		ans = len(counts)
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(q, w) = map(int, input().split())
	a = list(map(int, input().split()))
	a.append(0)
	a = sorted(set(a))
	for j in range(1, q + 1):
		if a[-j - 1] <= w * j:
			print(j)
			break


k = ''
for i in range(int(input())):
	(x, y) = map(int, input().split())
	li = list(map(int, input().split()))
	se = list(set(li))
	se.sort()
	se = se[::-1]
	li.sort()
	dic = {}
	p = []
	su = 0
	for i in range(len(li)):
		if dic.get(li[i]) == None:
			dic[li[i]] = 0
		dic[li[i]] += 1
		su += li[i]
	l = 0
	j = 0
	for i in range(len(se)):
		if l >= se[i]:
			break
		else:
			j += 1
			l += y
	k += str(j) + '\n'
print(k)


from sys import stdin, stdout
a = int(stdin.readline())
result = ''
for _ in range(a):
	(n, r) = map(int, stdin.readline().split())
	monsters = list(set((int(m) for m in stdin.readline().split())))
	monsters.sort()
	(shots, acc) = (0, 0)
	while monsters and monsters[-1] - acc > 0:
		monsters.pop()
		shots += 1
		acc += r
	result += str(shots) + '\n'
stdout.write(result)


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000010
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	(n, r) = arrIN()
	a = sorted(set(arrIN()), reverse=True)
	n = len(a)
	if n == 1:
		print(1)
	else:
		ans = 0
		t = 0
		for i in range(n):
			a[i] -= t * r
			if a[i] > 0:
				ans += 1
				t += 1
		print(ans)


def main():
	answer = ''
	for query in range(int(input())):
		ans = ''
		(n, r) = map(int, input().split(' '))
		monsters = list(set(list(map(int, input().split(' ')))))
		monsters.sort(reverse=True)
		shots = 0
		for monster in monsters:
			if shots * r >= monster:
				ans = shots
				break
			else:
				shots += 1
		if ans == '':
			ans = shots
		answer += str(ans) + '\n'
	print(answer)
main()


def main():
	number_of_queries = int(input())
	for i in range(number_of_queries):
		(pushed, missiles) = (0, 0)
		values = input().split(' ')
		number_of_enemies = int(values[0])
		distance = int(values[1])
		positions = input().split(' ')
		if number_of_enemies == 1:
			missiles += 1
		else:
			positions = list(set(map(int, positions)))
			positions.sort(reverse=True)
			for j in positions:
				if pushed >= j:
					break
				else:
					pushed += distance
					missiles += 1
		print(missiles)
main()


import sys
input = sys.stdin.readline
for j in ' ' * int(input()):
	(n, r) = map(int, input().split())
	q = sorted(set(map(int, input().split())))[::-1]
	c = 0
	for i in q:
		if i <= c * r:
			break
		c += 1
	print(c)


import os, sys, atexit
from io import BytesIO, StringIO
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
for i in range(int(input())):
	(n, r) = map(int, input().split())
	x = sorted(map(int, input().split()))
	i = n - 1
	j = 0
	c = 0
	ans = 0
	while i >= 0 and i >= j and (j < n):
		ans += 1
		d = x[i]
		c += r
		while i >= 0 and x[i] == d:
			i -= 1
		while j < n and x[j] <= c:
			j += 1
	print(ans)


a = int(input())
result = ''
for _ in range(a):
	(n, r) = map(int, input().split())
	monsters = sorted(set(map(int, input().split())))
	(shots, acc) = (0, 0)
	while monsters and monsters[-1] - acc > 0:
		monsters.pop()
		shots += 1
		acc += r
	result += str(shots) + '\n'
print(result[:-1])


import sys
input = sys.stdin.readline
import heapq

def main():
	q = int(input())
	for _ in range(q):
		(n, r) = [int(x) for x in input().split()]
		h = []
		s_h = set()
		p = [int(x) for x in input().split()]
		for x in p:
			if -x not in s_h:
				heapq.heappush(h, -x)
				s_h.add(-x)
		count = 0
		while True:
			if len(h) == 0:
				break
			x = -heapq.heappop(h)
			if x - count * r <= 0:
				break
			count += 1
		print(count)
main()


n = int(input())
result = ''
for _ in range(n):
	(numMon, distance) = map(int, input().split())
	monsters = sorted(set(map(int, input().split())))
	if numMon == 1:
		result += '1' + '\n'
	else:
		(bombs, y) = (0, 0)
		while monsters and monsters[-1] - y > 0:
			monsters.pop()
			bombs += 1
			y += distance
		result += str(bombs) + '\n'
print(result[:-1])


import math
t = int(input())
k = []
for test in range(t):
	(n, r) = [int(x) for x in input().split()]
	arr1 = [int(x) for x in input().split()]
	x = {}
	for i in range(n):
		x[arr1[i]] = 1
	arr = list(x.keys())
	arr.sort()
	req = []
	for i in arr:
		req.append(math.ceil(i / r))
	n = len(arr)
	ans = 0
	for i in range(n - 1, -1, -1):
		x = n - i - 1
		if x < req[i]:
			ans += 1
	k.append(ans)
for i in range(t):
	print(k[i])


import sys
readline = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, r) = map(int, readline().split())
	m = list(map(int, readline().split()))
	m.sort()
	t = m[len(m) - 1]
	count = 1
	dist = r
	for i in range(n):
		tmp = m[n - i - 1]
		if tmp - dist <= 0:
			break
		if t != tmp:
			t = tmp
			count += 1
			dist += r
	print(count)


tests = int(input())
s = ''

def shots():
	shots = 0
	for m in monsters:
		if m > r * shots:
			shots += 1
		else:
			return str(shots)
	return str(shots)
for k in range(tests):
	(n, r) = map(int, input().split())
	monsters = sorted(list(set(map(int, input().split()))), reverse=True)
	s += shots() + '\n'
print(s)


import os, sys, atexit
from io import BytesIO, StringIO
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
_OUTPUT_BUFFER = StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
q = int(input().strip())
for _ in range(q):
	(n, r) = map(int, input().strip().split())
	a = list(map(int, input().split()))
	s = sorted(set(a), reverse=True)
	(d, cnt) = (0, 0)
	for i in s:
		if i <= d:
			break
		d += r
		cnt += 1
	print(cnt)


res = []
for qq in range(int(input())):
	(n, r) = map(int, input().split())
	st = set(map(int, input().split()))
	l = sorted(st, reverse=True)
	ans = 0
	kill = 0
	for i in l:
		if i <= kill:
			break
		ans += 1
		kill += r
	res.append(ans)
for i in res:
	print(i)


numberConsultas = int(input())
for i in range(numberConsultas):
	empurroes = 0
	misseis = 0
	(mapA, mapB) = map(int, input().split(' '))
	enemy = input().split(' ')
	if mapA == 1:
		misseis += 1
	else:
		enemy = list(set(map(int, enemy)))
		enemy.sort(reverse=True)
		for j in enemy:
			if empurroes >= j:
				break
			else:
				empurroes += mapB
				misseis += 1
	print(misseis)


import sys
tc = int(sys.stdin.readline())
for _ in range(tc):
	(n, r) = map(int, sys.stdin.readline().split())
	arr = sorted(set(map(int, sys.stdin.readline().split())))
	idx = len(arr) - 1
	cnt = 0
	ans = 0
	while idx >= 0:
		if arr[idx] - cnt > 0:
			ans += 1
			cnt += r
		idx -= 1
	print(ans)


R = lambda : map(int, input().split())
(q,) = R()
a = []
for _ in [0] * q:
	(n, r) = R()
	a += (sum((x - k * r > 0 for (k, x) in enumerate(sorted(set(R()))[::-1]))),)
print(' '.join(map(str, a)))


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	(N, R) = map(int, input().split())
	A = set(map(int, input().split()))
	Query.append((N, R, A))
for (N, R, A) in Query:
	B = sorted(list(A), reverse=True)
	c = 0
	for b in B:
		if b - c * R > 0:
			c += 1
	print(c)


res = []
tc = int(input())
for j in range(tc):
	(x, r) = map(int, input().split())
	a = set(map(int, input().split()))
	a = list(sorted(a, reverse=True))
	ans = cnt = 0
	for i in range(len(a)):
		if a[i] <= cnt:
			break
		ans = ans + 1
		cnt = cnt + r
	res.append(str(ans))
print('\n'.join(res))


import sys
lines = sys.stdin.readlines()
num_cases = int(lines[0])
for i in range(num_cases):
	(n, r) = map(int, lines[2 * i + 1].split())
	L = sorted(set([int(x) for x in list(lines[2 * i + 2].split())]))
	thresh = 0
	while L and L.pop() - thresh * r > 0:
		thresh += 1
	print(thresh)


q = int(input())
minN = ''
for number in range(q):
	(n, r) = map(int, input().split())
	x = sorted(set(map(int, input().split())))
	res = 0
	tmp = 0
	for i in x[::-1]:
		if i > tmp:
			res += 1
			tmp += r
	minN += str(res) + '\n'
print(minN)


from sys import stdin, stdout
input = stdin.readline

def case():
	(n, r) = map(int, input().split())
	monsters = sorted(set(map(int, input().split())), reverse=True)
	cnt = 0
	shift = 0
	for pos in monsters:
		if pos - shift > 0:
			cnt += 1
			shift += r
		else:
			break
	return cnt

def main():
	q = int(input())
	ans = []
	for _ in range(q):
		ans.append(str(case()))
	stdout.write('\n'.join(ans))
main()


n = int(input())
ans = ''
for _ in range(n):
	(m, r) = map(int, input().split())
	s = sorted(set(map(int, input().split())))[::-1]
	count = 0
	for i in s:
		if i <= count * r:
			break
		count += 1
	ans += str(count) + '\n'
print(ans)


import os
from sys import stdin, stdout

def gn():
	return list(map(float, stdin.readline().rstrip().split()))

def mi(i):
	return list(map(int, i))
n = int(gn()[0])
querys = []
for ind in range(n):
	(M, r) = mi(gn())
	xs = mi(gn())
	xs = list(set(xs))
	xs = sorted(xs)
	ans = 0
	limit = 0
	while len(xs) > 0 and xs[-1] > limit:
		ans += 1
		del xs[-1]
		limit += r
	print(ans)


from math import *
from collections import *
from itertools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(100000000)
import os
import sys
from sys import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	ans = 0
	while l:
		x = l.pop()
		if x - c <= 0:
			break
		while l and l[-1] == x:
			l.pop()
		c += r
		ans += 1
	print(ans)


import sys

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def bisearch_min(mn, mx, func):
	ok = mx
	ng = mn
	while ng + 1 < ok:
		mid = (ok + ng) // 2
		if func(mid):
			ok = mid
		else:
			ng = mid
	return ok

def calc(m):
	X2 = X[:len(X) - m]
	X2[-1] -= r * m
	return X2[-1] <= 0
for _ in range(INT()):
	(n, r) = MAP()
	X = sorted(set(LIST()))
	print(bisearch_min(0, len(X), calc))


import math

def count_shot():
	(num_enemies, r) = [int(elem) for elem in input().split(' ')]
	pos = [int(elem) for elem in input().split(' ')]
	num_shots = 0
	tmp = set()
	for enemy in pos:
		tmp.add(enemy)
	enemies = []
	for enemy in tmp:
		enemies.append(math.ceil(enemy / r))
	enemies.sort(reverse=True)
	while num_shots < len(enemies):
		num_shots += 1
		if num_shots != len(enemies) and num_shots >= enemies[num_shots]:
			return num_shots
	return num_shots
num_queries = int(input())
answers = []
for _ in range(num_queries):
	answers.append(count_shot())
for ans in answers:
	print(ans)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, r) = mapin()
	a = listin()
	a = list(set(a))
	a.sort()
	z = deque(a)
	count = 0
	while z:
		z.pop()
		count += 1
		if z:
			while z[0] <= r * count:
				z.popleft()
				if not z:
					break
	print(count)


import sys
input = sys.stdin.readline
q = int(input())
for i in range(q):
	(n, r) = map(int, input().split())
	lis = list(set(map(int, input().split())))
	lis.sort(reverse=True)
	lis.append(-1)
	cnt = 0
	ra = 0
	for i in range(n + 10):
		if lis[i] - ra <= 0:
			print(cnt)
			break
		ra += r
		cnt += 1


ans_str = ''
for i in range(int(input())):
	(n, r) = map(int, input().split())
	v = set(map(int, input().split()))
	values = sorted(v, reverse=True)
	ans = 0
	kill = 0
	for i in values:
		if i <= kill:
			break
		ans += 1
		kill += r
	ans_str = ans_str + str(ans) + '\n'
print(ans_str)


from sys import stdin, stdout
gh = ''
for _ in ' ' * int(input()):
	(a, b) = map(int, stdin.readline().split())
	z = sorted(set(map(int, stdin.readline().split())))[::-1]
	m = 0
	k = 0
	for i in z:
		if k + i <= 0:
			break
		else:
			m += 1
			k -= b
	gh += str(m) + ' '
print(gh)


import heapq
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

def solve():
	(N, R) = map(int, input().split())
	M = list(set(map(lambda x: -int(x), input().split())))
	heapq.heapify(M)
	ans = 0
	cur_pos = 0
	while M:
		cur_vanish = -heapq.heappop(M)
		if cur_vanish > cur_pos:
			cur_pos += R
			ans += 1
		else:
			break
	print(ans)
N = int(input())
for _ in range(N):
	solve()


import sys
input = sys.stdin.readline

def missile(r: int, A: 'Array[int]') -> int:
	for (i, a) in enumerate(A):
		if i * r >= a:
			return i
	return len(A)

def main():
	Q = int(input())
	ans = []
	for _ in range(Q):
		(N, R) = map(int, input().split())
		X = sorted(set(map(int, input().split())), reverse=1)
		cnt = missile(R, X)
		ans.append(cnt)
	print('\n'.join(map(str, ans)))
main()


ans = []
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	a = list(set(list(map(int, input().split()))))
	a.sort(reverse=True)
	c = 0
	for i in range(len(a)):
		if a[i] <= c:
			break
		c += r
	ans.append(str(c // r))
print('\n'.join(ans))


a = int(input())
result = ''
for _ in range(a):
	(n, r) = map(int, input().split())
	monsters = set((int(m) for m in input().split()))
	(shots, acc) = (0, 0)
	for m in sorted(monsters, reverse=True):
		if m - acc <= 0:
			break
		shots += 1
		acc += r
	result += str(shots) + '\n'
print(result[:-1])


import sys

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

def gints():
	return map(int, sys.stdin.readline().strip().split())
t = int(input())
ans = ''
for _ in range(t):
	(x, y) = gints()
	b = glist()
	a = []
	s = set()
	for i in b:
		if i in s:
			continue
		else:
			s.add(i)
			a.append(i)
	a.sort()
	n = 0
	j = len(a) - 1
	while j >= 0:
		if a[j] - y * n > 0:
			n += 1
			j -= 1
		else:
			break
	temp = str(n) + '\n'
	ans += temp
print(ans)


from sys import stdin
input = stdin.readline
R = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, r) = R()
	k = ans = 0
	for i in sorted(set(R()), reverse=True):
		if i - k > 0:
			ans += 1
			k += r
		else:
			break
	print(ans)


import math

def process():
	(num_enemies, r) = [int(elem) for elem in input().split(' ')]
	pos = [int(elem) for elem in input().split(' ')]
	tmp = set()
	for enemy in pos:
		tmp.add(enemy)
	enemies = []
	for enemy in tmp:
		enemies.append(math.ceil(enemy / r))
	enemies.sort(reverse=True)
	shot = 0
	while shot < len(enemies):
		shot += 1
		if shot != len(enemies) and shot >= enemies[shot]:
			return shot
	return shot

def main():
	queue = int(input())
	answer = []
	while queue > 0:
		ans = process()
		answer.append(ans)
		queue += -1
	for i in answer:
		print(i)
main()


INT_MAX = 10 ** 30 + 7
MOD = 10 ** 9 + 7
import sys
input = sys.stdin.readline

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
s = ''
for i in range(int(input())):
	(n, r) = INPUT()
	C = INPUT()
	b = 0
	A = list(set(C))
	n = len(A)
	A.sort()
	while n > 0 and A[-1] >= 0:
		A[-1] = A[-1] - b * r
		if A[-1] <= 0:
			break
		else:
			b += 1
			A.pop()
			n -= 1
	s += str(b) + '\n'
print(s)


from sys import stdin

def main():
	q = int(stdin.readline().strip())
	for _ in range(q):
		(n, r) = map(int, stdin.readline().split())
		a = set(map(int, stdin.readline().split()))
		if n == 1 or len(a) == 1:
			print(1)
			continue
		a = sorted(a, reverse=True)
		ans = 0
		for i in range(len(a) - 1):
			ans += 1
			if a[i + 1] <= ans * r:
				break
		if a[len(a) - 1] > ans * r:
			ans += 1
		print(ans)
main()


import sys

def main():
	for _ in range(int(input())):
		(x, y) = map(int, sys.stdin.readline().split())
		l = list(set(map(int, sys.stdin.readline().split())))
		l.sort()
		n = len(l)
		ans = 0
		for i in range(n):
			ans += l[i] - (n - i - 1) * y > 0
		print(ans)
main()


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		(n, r) = map(int, input().split())
		a = sorted(set(map(int, input().split())))
		z = 0
		su = 0
		while a:
			if su + a.pop() > 0:
				su -= r
				z += 1
			else:
				break
		print(z)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import *
for _ in range(int(input())):
	(n, x) = map(int, stdin.readline().split())
	A = sorted(set(map(int, stdin.readline().split())))
	ans = 0
	i = len(A) - 1
	while i > -1 and x * ans < A[i]:
		i -= 1
		ans += 1
	stdout.write(str(ans))
	stdout.write('\n')


from sys import stdin, stdout
outputs = []
for __ in range(int(stdin.readline().strip())):
	(n, r) = map(int, stdin.readline().strip().split())
	x = sorted([int(num) for num in stdin.readline().strip().split()])
	prev = None
	missile = 0
	while x:
		if prev is None:
			missile += 1
		elif x[-1] == prev:
			pass
		elif x[-1] - missile * r > 0:
			missile += 1
		prev = x[-1]
		x.pop()
	outputs.append(missile)
for output in outputs:
	stdout.write(f'{output}\n')


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, r) = [int(w) for w in input().split()]
	x = sorted({int(w) for w in input().split()})
	n = len(x)
	for i in range(n):
		if x[i] > r * (n - i - 1):
			break
	print(n - i)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	(n, r) = map(int, input().split())
	l = list(map(int, input().split()))
	l = list(set(l))
	l.sort(reverse=True)
	ans = 0
	curr = 0
	for i in range(len(l)):
		if l[i] - curr > 0:
			ans += 1
			curr += r
	print(ans)


import array
import math
import os
import sys
DEBUG = 'DEBUG' in os.environ

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

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)

def solve(N, R, X):
	v = list(set(X))
	v.sort(reverse=True)
	off = 0
	c = 0
	i = 0
	while i < len(v):
		x = v[i]
		if x <= off:
			break
		i += 1
		c += 1
		off += R
	return c

def main():
	Q = int(inp())
	for _ in range(Q):
		(N, R) = [int(e) for e in inp().split()]
		X = [int(e) for e in inp().split()]
		print(solve(N, R, X))
main()


import sys
input = sys.stdin.readline
for i in range(int(input())):
	(n, r) = map(int, input().split())
	b = sorted(list(set(list(map(int, input().split())))), reverse=True)
	j = 0
	s = 0
	n = len(b)
	while j < n and b[j] > s:
		j += 1
		s += r
	print(j)


loop = int(input())
ataque = []
pontos = []
for i in range(0, loop):
	ataque.append(int(input().split(' ')[1]))
	pontos.append(input().split(' '))
for i in range(0, loop):
	local_atual = []
	local_escondido = []
	for j in range(0, len(pontos[i])):
		local_atual.append(int(pontos[i][j]))
	a = set(local_atual)
	local_escondido = list(a)
	local_escondido.sort(reverse=True)
	count = 0
	for j in range(0, len(local_escondido)):
		atack_atual = ataque[i] * j
		if local_escondido[j] > atack_atual:
			count += 1
		else:
			print(count)
			break
		if count == len(local_escondido):
			print(count)
			break


import sys
input = sys.stdin.buffer.readline
q = int(input())
for _ in range(q):
	(n, r) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	arr2 = set(arr)
	arr = list(arr2)
	arr.sort()
	zeroPt = 0
	ptr = len(arr) - 1
	cnt = 0
	while True:
		if ptr == -1:
			break
		if arr[ptr] <= zeroPt:
			break
		cnt += 1
		zeroPt += r
		ptr -= 1
	print(cnt)


import sys
from math import ceil
readline = sys.stdin.readline
Q = int(readline())
Ans = [None] * Q
for qu in range(Q):
	(N, r) = map(int, readline().split())
	A = list(map(int, readline().split()))
	A = list(set(A))
	A.sort()
	A = [0] + A
	N = len(A)
	Ans[qu] = min((N - i for i in range(1, N + 1) if A[i - 1] <= r * (N - i)))
print('\n'.join(map(str, Ans)))


t = int(input())
while t:
	t -= 1
	(n, r) = map(int, input().split())
	x = set(map(int, input().split()))
	if n == 1:
		print(1)
	else:
		x = sorted(list(x), reverse=True)
		ans = 0
		ran = 0
		for i in range(len(x)):
			if x[i] - ran > 0:
				ans += 1
				ran += r
			else:
				break
		print(ans)


import os
import sys
from io import BytesIO, IOBase
get_int = lambda : int(input())
get_mul_int = lambda : map(int, input().rstrip().split())
get_list = lambda : list(map(int, input().rstrip().split()))
TEST_CASES = True

def main():
	(n, r) = get_mul_int()
	a = get_list()
	new = list(set(a))
	new.sort(reverse=True)
	count = 0
	for i in range(len(new)):
		new[i] -= count * r
		if new[i] <= 0:
			break
		count += 1
	print(count)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
if TEST_CASES:
	[main() for _ in range(int(input()))]
else:
	main()


q = int(input())
ans_s = list()
for _ in [0] * q:
	(n, r) = map(int, input().split())
	xs = sorted(set(map(int, input().split())))[::-1]
	ans = sum([x - i * r > 0 for (i, x) in enumerate(xs)])
	ans_s.append(ans)
print(' '.join(map(str, ans_s)))


result = ''

def solve(enemies_qtd, impact, monsters):
	for bombs in range(len(monsters)):
		if monsters[bombs] <= bombs * impact:
			return bombs
	return len(monsters)
for _ in range(int(input())):
	(enemies_qtd, impact) = map(int, input().split())
	result += str(solve(enemies_qtd, impact, sorted(set(map(int, input().split())), reverse=True))) + '\n'
print(result)


def greddy(n, r):
	distance = 0
	sum_bombs = 0
	x = input().split()
	if n == 1:
		sum_bombs = 1
	else:
		x = sorted(set(map(int, x)), reverse=True)
		for monster in x:
			if distance - monster < 0:
				sum_bombs += 1
				distance += r
			else:
				break
	return sum_bombs
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	print(greddy(n, r))


queries = int(input())
output = ''
for _ in range(queries):
	(n, r) = map(int, input().split())
	m = sorted(set(map(int, input().split())))[::-1]
	count = 0
	for i in m:
		if i <= count * r:
			break
		count += 1
	output += str(count) + '\n'
print(output)


from math import ceil
from sys import stdin
input = stdin.readline
q = int(input())
for i in range(q):
	(n, r) = map(int, input().split())
	my_list = sorted(set(map(int, input().split())))
	list_of_answer = []
	for j in range(len(my_list)):
		list_of_answer.append(min(len(my_list) - j, ceil(my_list[j] / r)))
	print(max(list_of_answer))


import sys
input = sys.stdin.buffer.readline
q = int(input())
for i in range(q):
	(n, r) = [int(item) for item in input().split()]
	a = list(set((int(item) for item in input().split())))
	n = len(a)
	a.sort(reverse=True)
	ok = False
	for (i, item) in enumerate(a):
		if i < n - 1 and a[i + 1] <= (i + 1) * r:
			ans = i + 1
			ok = True
			break
	if ok:
		print(ans)
	else:
		print(n)


import sys

def input():
	str = sys.stdin.readline()
	return str[:-1]

def unique(x, first, last):
	if first == last:
		return last
	result = first
	while first + 1 != last:
		first += 1
		if x[result] != x[first]:
			result += 1
			x[result] = x[first]
	return result + 1
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	x = list(map(int, input().split()))
	x.sort(reverse=True)
	siz = unique(x, 0, len(x))
	rc = 0
	tt = 0
	for i in range(siz):
		a = x[i]
		if rc < a:
			rc += r
			tt += 1
		else:
			break
	print(tt)


import sys

def solve(n, r, xs):
	xs = sorted(set(xs), reverse=True)
	(ans, shift) = (0, 0)
	for x in xs:
		if x <= shift:
			break
		ans += 1
		shift += r
	print(ans)
q = int(sys.stdin.readline())
for i in range(q):
	(n, r) = map(int, sys.stdin.readline().split(' '))
	xs = map(int, sys.stdin.readline().split(' '))
	solve(n, r, xs)


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	x = list(map(int, input().split()))
	x.sort()
	seen = set()
	res = []
	for v in x:
		if not v in seen:
			res.append(v)
			seen.add(v)
	x = res
	modif = 0
	curr = len(x) - 1
	i = 0
	while curr >= 0:
		vallast = x[curr]
		if modif >= vallast:
			break
		modif += r
		i += 1
		curr -= 1
	print(i)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, r) = map(int, input().split())
	a = list(map(int, input().split()))
	b = set(a)
	a = sorted(list(b))
	cnt = 0
	ans = 0
	while True:
		ans += 1
		a.pop()
		if not a:
			break
		rng = ans * r
		while cnt < len(a) and a[cnt] <= rng:
			cnt += 1
		if cnt == len(a):
			break
	print(ans)


q = int(input())
s = ''
for i in range(q):
	(n, r) = map(int, input().split())
	x = set(map(int, input().split()))
	x = list(sorted(x))
	y = 0
	while x and x[-1] > r * y:
		x.pop()
		y += 1
	s += str(y) + '\n'
print(s)


from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n
		self.lista = [[_] for _ in range(n)]

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]
		self.lista[a] += self.lista[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def prime_factors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def all_factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def fibonacci_modP(n, MOD):
	if n < 2:
		return 1
	return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD

def factorial_modP_Wilson(n, p):
	if p <= n:
		return 0
	res = p - 1
	for i in range(n + 1, p):
		res = res * cached_fn(InverseEuler, i, p) % p
	return res

def binary(n, digits=20):
	b = bin(n)[2:]
	b = '0' * (digits - len(b)) + b
	return b

def is_prime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def generate_primes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	return prime
factorial_modP = []

def warm_up_fac(MOD):
	global factorial_modP, fac_warm_up
	if fac_warm_up:
		return
	factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
	for i in range(2, fac_warm_up_size):
		factorial_modP[i] = factorial_modP[i - 1] * i % MOD
	fac_warm_up = True

def InverseEuler(n, MOD):
	return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
	global fac_warm_up, factorial_modP
	if not fac_warm_up:
		warm_up_fac(MOD)
		fac_warm_up = True
	return factorial_modP[n] * (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD) % MOD) % MOD

def get_int():
	return int(stdin.readline().strip())

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

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def ncr(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def binary_search(i, li):
	fn = lambda x: li[x] - x // i
	x = -1
	b = len(li)
	while b >= 1:
		while b + x < len(li) and fn(b + x) > 0:
			x += b
		b = b // 2
	return x
TestCases = True
optimise_for_recursion = True

def main():
	(n, r) = get_tuple()
	li = list(set(get_list()))
	li.sort()
	drop = 0
	while len(li) > 0 and li[-1] - drop > 0:
		drop += r
		li.pop()
	print(drop // r)
if TestCases:
	for i in range(get_int()):
		main()
else:
	main() if not optimise_for_recursion else threading.Thread(target=main).start()


import sys
from math import *
import threading
from itertools import count
from pprint import pprint
from collections import defaultdict
from heapq import heapify, heappop, heappush
sys.setrecursionlimit(300000)
mod = 10 ** 9 + 7
inf = 10 ** 15
decision = ['NO', 'YES']
yes = 'YES'
no = 'NO'
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def npr(n, r):
	return factorial(n) // factorial(n - r) if n >= r else 0

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r)) if n >= r else 0

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val):
	ans = -1
	lb = 0
	ub = len(li) - 1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li

def primefactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n //= 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n //= i
	if n > 2:
		factors.append(n)
	return factors

def prod(li):
	ans = 1
	for i in li:
		ans *= i
	return ans

def sumk(a, b):
	print('called for', a, b)
	ans = a * (a + 1) // 2
	ans -= b * (b + 1) // 2
	return ans
karmanya = 1
for _ in range(int(input()) if karmanya else 1):
	(n, r) = map(int, input().split())
	a = list(set(map(int, input().split())))
	a.sort()
	cnt = 0
	ans = 0
	n = len(a)
	for i in range(n - 1, -1, -1):
		if a[i] - cnt * r <= 0:
			break
		else:
			ans += 1
			cnt += 1
	print(ans)


from sys import stdin, stdout
a = int(stdin.readline())
result = ''
for _ in range(a):
	(n, r) = map(int, stdin.readline().split())
	monsters = [int(m) for m in stdin.readline().split()]
	monsters.sort(reverse=True)
	(shots, acc) = (0, 0)
	for i in range(len(monsters)):
		if i and monsters[i] == monsters[i - 1]:
			continue
		if monsters[i] - acc <= 0:
			break
		shots += 1
		acc += r
	stdout.write(str(shots) + '\n')


import sys

def kek():
	t = int(input())
	for KK in range(t):
		(n, r) = map(int, sys.stdin.readline().split())
		a = list(map(int, sys.stdin.readline().split()))
		a = list(reversed(sorted(a)))
		seUd = set()
		countDel = 0
		for i in range(len(a)):
			if a[i] not in seUd and countDel < a[i]:
				seUd.add(a[i])
				countDel += r
		print(len(seUd))
kek()


q = int(input())
d = []
for _ in range(q):
	(n, r) = map(int, input().split())
	a = sorted(list(set(map(int, input().split()))))
	b = len(a)
	p = 0
	z = 0
	while p == 0:
		z += 1
		if a[b - z - 1] - r * z <= 0 or b == z:
			p = 1
	d.append(z)
for x in d:
	print(x)


s = ''
for tc in range(int(input())):
	(a, b) = map(int, input().split())
	l = set(map(int, input().split()))
	ans = 0
	d = 0
	for i in sorted(l, reverse=True):
		if i <= d:
			break
		ans += 1
		d += b
	s += str(ans) + '\n'
print(s)


import sys, copy
input = sys.stdin.readline
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	a = sorted(set(map(int, input().split())))
	count = 0
	while a and a[-1] > count * r:
		a.pop()
		count += 1
	print(count)


import sys
inputt = int(input())
for i in range(inputt):
	(x, y) = map(int, sys.stdin.readline().split())
	array = sorted(set(map(int, sys.stdin.readline().split())))
	first = 0
	result = 0
	size = len(array)
	end = size - 1
	while first <= end:
		center = (first + end) // 2
		if array[center] - (size - center - 1) * y > 0:
			result = size - center
			end = center - 1
		else:
			first = center + 1
	print(result)


import sys
import math
input = sys.stdin.readline
arr = []
n = 0
r = 0

def check(k):
	if arr[n - k - 1] - k * r > 0:
		return False
	return True

def binarySearch(l, r):
	if r >= l:
		mid = l + (r - l) // 2
		if check(mid):
			if r == l:
				return l
			return binarySearch(l, mid)
		else:
			return binarySearch(mid + 1, r)
	else:
		return n
q = int(input())
for i in range(q):
	(n, r) = map(int, input().split())
	l = list(map(int, input().split()))
	arr = list(set(l))
	n = len(arr)
	arr.sort()
	print(binarySearch(1, n - 1))


from sys import stdin
q = int(stdin.readline().strip())
for _ in range(q):
	(n, r) = list(map(int, stdin.readline().split()))
	monsters = list(map(int, stdin.readline().split()))
	monsters.sort()
	monsters = list(set(monsters))
	impact = 0
	count = 0
	for i in range(len(monsters) - 1, -1, -1):
		if monsters[i] - impact <= 0:
			break
		else:
			impact += r
			count += 1
	print(count)


from sys import stdin, stdout
I = stdin.readline
print = stdout.write
for _ in range(int(I())):
	(n, r) = map(int, I().split())
	a = list(map(int, I().split(' ')))
	a = list(dict.fromkeys(a))
	a.sort(reverse=True)
	d = 0
	c = 0
	for i in a:
		if i - d * r > 0:
			d += 1
			c += 1
		else:
			break
	print(str(c) + '\n')


import sys
for q in range(int(input())):
	(n, r) = [int(i) for i in sys.stdin.readline().split()]
	d = sorted(list(set([int(i) for i in sys.stdin.readline().split()])))
	n = len(d)
	found = False
	for i in range(1, n):
		nv = d[n - i - 1]
		if r * i >= nv:
			sys.stdout.write(str(i) + '\n')
			found = True
			break
	if not found:
		sys.stdout.write(str(n) + '\n')


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
q = int(input())
for i in range(q):
	(n, r) = map(int, input().split())
	l = list(map(int, input().split()))
	l = list(set(l))
	l.sort()
	x = 1
	ans = 1
	for i in range(len(l) - 2, -1, -1):
		if l[i] - r * x <= 0:
			break
		else:
			ans += 1
			x += 1
	print(ans)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(n, r) = int_array()
	x = sorted(list(set(int_array())))
	ans = 0
	while x:
		if x[-1] - ans * r > 0:
			ans += 1
			x.pop()
		else:
			break
	print(ans)


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from heapq import heappush as hpush
from heapq import heappop as hpop
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
for _ in range(ri(1)):
	(n, r) = ri()
	a = ri()
	a = list(set(a))
	a.sort()
	ans = 0
	cur = 0
	start = a[-1]
	for i in range(len(a) - 1, -1, -1):
		if a[i] - cur > 0:
			cur += r
			ans += 1
	print(ans)


from sys import stdin, stdout
a = int(stdin.readline())
result = ''
for _ in range(a):
	(n, r) = map(int, stdin.readline().split())
	monsters = set(map(int, stdin.readline().split()))
	(shots, acc) = (0, 0)
	for m in sorted(monsters, reverse=True):
		if m - acc <= 0:
			break
		shots += 1
		acc += r
	stdout.write(str(shots) + '\n')


def killMonsters(qtdPerguntas, distancia, numInimigos):
	for i in range(0, qtdPerguntas):
		local_atual = []
		local_escolhido = []
		for j in range(0, len(distancia[i])):
			local_atual.append(int(distancia[i][j]))
		a = set(local_atual)
		local_escolhido = list(a)
		local_escolhido.sort(reverse=True)
		count = 0
		for j in range(0, len(local_escolhido)):
			atack_atual = numInimigos[i] * j
			if local_escolhido[j] > atack_atual:
				count += 1
			else:
				print(count)
				break
			if count == len(local_escolhido):
				print(count)
				break

def killEmAll(qtdPerguntas):
	numInimigos = []
	distancia = []
	for i in range(0, qtdPerguntas):
		numInimigos.append(int(input().split(' ')[1]))
		distancia.append(input().split(' '))
	killMonsters(qtdPerguntas, distancia, numInimigos)
qtdPerguntas = int(input())
killEmAll(qtdPerguntas)


t = int(input())
ans = ''
for _ in range(t):
	(n, r) = map(int, input().split())
	m = sorted(set(map(int, input().split())), reverse=True)
	count = 0
	for i in m:
		if i <= count * r:
			break
		count += 1
	ans += str(count) + '\n'
print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	x = sorted(set(map(int, input().split())))
	cnt = 0
	now_right_idx = len(x) - 1
	total_explosion = 0
	while now_right_idx >= 0:
		cnt += 1
		total_explosion += r
		now_right_idx -= 1
		while now_right_idx >= 0 and x[now_right_idx] <= total_explosion:
			now_right_idx -= 1
	print(cnt)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(n, r) = value()
	a = sorted(set(array()), reverse=True)
	c = 0
	for i in a:
		if i - c * r <= 0:
			break
		else:
			c += 1
	print(c)


from sys import stdin, stdout
input = stdin.readline
print = stdout.write

def solve():
	(n, k) = map(int, input().split())
	xi = sorted(list(set([int(i) - k for i in input().split()])))
	if len(xi) == 1:
		print(str(1) + '\n')
	else:
		r = 0
		ind = len(xi) - 2
		while ind > -1:
			if xi[ind] - r * k > 0:
				ind -= 1
				r += 1
			else:
				break
		print(str(r + 1) + '\n')
q = int(input())
for _ in range(0, q):
	solve()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	x = sorted([*{*map(int, input().split())}])
	shift = 0
	missiles = 0
	for i in x[::-1]:
		if shift >= i:
			break
		missiles += 1
		shift += r
	print(missiles)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, r) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	cur = 0
	ans = 0
	a = list(set(a))
	a.sort(reverse=1)
	for i in range(len(a)):
		if a[i] > cur:
			ans += 1
			cur += r
		else:
			break
	print(ans)


import sys

def main():
	for _ in range(int(input())):
		(x, y) = [int(x) for x in sys.stdin.readline().split()]
		l = list(set((int(x) for x in sys.stdin.readline().split())))
		l.sort()
		n = len(l)
		low = 0
		high = n - 1
		ans = 0
		while low <= high:
			mid = (low + high) // 2
			if l[mid] - (n - mid - 1) * y > 0:
				ans = n - mid
				high = mid - 1
			else:
				low = mid + 1
		print(ans)
main()


import sys
input = sys.stdin.readline

def aux():
	return map(int, input().split())

def aux_list():
	b = list(set(list(map(int, input().split()))))
	b.sort(reverse=True)
	return b
for index in range(int(input())):
	(x, y) = aux()
	b = aux_list()
	x = len(b)
	result = -1
	for index_j in range(x):
		if b[index_j] % y == 0:
			p = min(index_j + 1, b[index_j] // y)
		else:
			p = min(index_j + 1, b[index_j] // y + 1)
		if p > result:
			result = p
	print(result)


def solve(n, r, pos):
	ans = 0
	pos = list(set(pos))
	pos.sort(reverse=True)
	to_left = 0
	for i in pos:
		if i - to_left <= 0:
			break
		to_left += r
		ans += 1
	return ans

def main():
	q = int(input())
	result = []
	for i in range(q):
		(n, r) = map(int, input().split())
		pos = list(map(int, input().split()))
		res = solve(n, r, pos)
		result.append(res)
	for r in result:
		print(r)
main()


import sys
input = sys.stdin.readline
T = int(input())
for i in range(0, T):
	(n, r) = map(int, input().split())
	a = list(set(map(int, input().split())))
	a.sort(reverse=1)
	leng = len(a)
	ans = 0
	for j in range(0, leng):
		if a[j] - ans * r > 0:
			ans += 1
		else:
			break
	print(ans)


import sys
input = sys.stdin.readline
import math
for _ in range(int(input())):
	(n, r) = [int(j) for j in input().split()]
	x = [int(j) for j in input().split()]
	x = list(set(x))
	x.sort()
	x1 = [math.ceil(i / r) for i in x]
	x2 = x1.copy()
	for i in range(1, len(x1)):
		x2[i] = max(x2[i - 1], x2[i])
	ans = 1
	for i in range(len(x1) - 2, -1, -1):
		if x2[i] <= ans:
			break
		else:
			ans += 1
	print(ans)


import sys
input = sys.stdin.readline
q = int(input())

def f(a, b, A):
	while b - a > 1:
		c = (a + b) // 2
		if X[-c - 1] <= c * R:
			b = c
		else:
			a = c
	if X[-a - 1] <= a * R:
		return a
	else:
		return b
for _ in range(q):
	(n, R) = map(int, input().split())
	X = sorted(list(set([int(i) for i in input().split()])))
	(l, r) = (0, len(X))
	print(f(l, r, X))


from sys import stdin
input = stdin.readline
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	x = list(map(int, input().split()))
	x.sort(reverse=True)
	knockbacks = []
	for i in range(len(x)):
		if i == 0 or x[i] != x[i - 1]:
			loc = x[i]
			knockbacks.append((loc + r - 1) // r)
	cnt = 0
	while True:
		if cnt >= len(knockbacks) or knockbacks[cnt] <= cnt:
			break
		else:
			cnt += 1
	print(cnt)


import sys
input = sys.stdin.readline
q = int(input())
for testcases in range(q):
	(n, r) = map(int, input().split())
	E = list(map(int, input().split()))
	E.append(0)
	E = sorted(set(E))
	for i in range(1, n + 1):
		if E[-i - 1] <= r * i:
			print(i)
			break


from sys import stdin
for i in range(int(stdin.readline())):
	(n, d) = map(int, stdin.readline().split())
	ar = list(map(int, stdin.readline().split()))
	ar = list(set(ar))
	ar.sort()
	x = len(ar) - 1
	count = 0
	ans = 0
	while x >= 0:
		if ar[x] - count > 0:
			ans += 1
			count += d
		else:
			break
		x -= 1
	print(ans)


import sys
input = sys.stdin.readline
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	l = set(map(int, input().split()))
	l = list(l)
	l = sorted(l)
	count = 0
	while l and l[-1] > count * b:
		l.pop()
		count += 1
	print(count)


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	xs = sorted(list(set(map(int, input().split()))), reverse=True)
	ans = 0
	p = 0
	while p < len(xs):
		count_x = (xs[p] + r - 1) // r
		if count_x <= p:
			ans = p
			break
		p += 1
	if p == len(xs):
		ans = len(xs)
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	if n == 1:
		a = input()
		print(1)
	elif r == 0:
		a = input()
		print(n)
	else:
		a = set(map(int, input().split()))
		a = sorted(list(a))
		n = len(a)
		j = n - 1
		m = 0
		c = 0
		for i in range(n - 1, -1, -1):
			if a[i] <= m:
				break
			else:
				m += r
				c += 1
		print(c)


import math

def process():
	numpush = input()
	position = input()
	li1 = numpush.split(' ')
	throw = int(li1[1])
	num = int(li1[0])
	li2 = position.split(' ')
	pos = {}
	for i in li2:
		if int(i) not in pos:
			pos[int(i)] = 1
	pos1 = []
	for i in pos:
		pos1.append(i)
	pos2 = []
	for i in pos1:
		number = math.ceil(i / throw)
		pos2.append(number)
	pos2.sort(reverse=True)
	shot = 0
	done = 0
	while shot < len(pos2) and done == 0:
		shot += 1
		if shot != len(pos2):
			if shot >= pos2[shot]:
				done = 1
	return shot

def main():
	que = int(input())
	answer = []
	while que > 0:
		ans = process()
		answer.append(ans)
		que += -1
	for i in answer:
		print(i)
main()


ans = list()
for _ in range(int(input())):
	(n, push) = map(int, input().split())
	enemies = sorted(set(map(int, input().split())))[::-1]
	s = 0
	for (i, x) in enumerate(enemies):
		if push * i >= enemies[i]:
			break
		else:
			s += 1
	ans.append(s)
print(*ans)


R = lambda : map(int, input().split())
q = int(input())
s = ''
for _ in range(q):
	(n, r) = map(int, input().split())
	num = 0
	for x in sorted(set(R()))[::-1]:
		if x - num * r > 0:
			num += 1
		else:
			break
	s += str(num) + '\n'
print(s)


def solution(s):
	from sys import stdin
	input = stdin.readline
	for i in range(t):
		(p, r) = map(int, input().split())
		s = list(map(int, set(input().split())))
		s.sort(reverse=True)
		res = acc = 0
		for k in s:
			if k - acc <= 0:
				break
			res += 1
			acc += r
		yield res
t = int(input())
print('\n'.join(map(str, solution(t))))


q = int(input())
response = []
while q > 0:
	(n, r) = map(int, input().split())
	monsters = sorted(set(map(int, input().split())))
	c = 0
	while len(monsters) != 0 and monsters[-1] > r * c:
		monsters.pop()
		c += 1
	response.append(c)
	q -= 1
for r in response:
	print(r)


R = lambda : map(int, input().split())
(q,) = R()
print(*(sum((x - i * r > 0 for (i, x) in enumerate(sorted(set(a))[::-1]))) for ((n, r), a) in ((R(), R()) for _ in [0] * q)))


from collections import Counter
from math import inf
from sys import stdin
import collections
import os
import sys
from io import IOBase, BytesIO
from sys import stdin, stdout
from math import sqrt
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange

def main():
	for q in range(int(input())):
		(n, r) = map(int, input().split())
		tx = [int(i) for i in input().split()]
		tx.sort()
		tt = set(tx)
		x = list(tt)
		ce = 0
		ans = 0
		for i in range(len(x) - 1, -1, -1):
			if x[i] - ce * r > 0:
				ans += 1
				ce += 1
			else:
				break
		print(ce)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'
main()


t = int(input())
s = ''
for i in range(t):
	(n, r) = map(int, input().split())
	a = set(map(int, input().split()))
	a = list(a)
	a.sort(reverse=True)
	cnt = 0
	a.append(1e+19)
	for i in range(len(a)):
		if a[i] <= i * r:
			break
		cnt += 1
	s += str(i) + '\n'
print(s)


st = ''
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	l = set(map(int, input().split()))
	p = sorted(l, reverse=True)
	k = o = 0
	for i in p:
		if i <= o:
			break
		o += y
		k += 1
	st += str(k) + '\n'
print(st)


import sys
q = int(sys.stdin.readline())
for _ in range(q):
	(n, r) = map(int, sys.stdin.readline().split())
	if n == 1:
		print(1)
		x = sys.stdin.readline()
		continue
	x = list(set(map(int, sys.stdin.readline().split())))
	x.sort(reverse=True)
	m = 0
	ans = 0
	for i in x:
		if i > r * m:
			m += 1
			ans += 1
		else:
			break
	print(ans)


ans = []

def solution(test):
	for i in range(test):
		(p, r) = map(int, input().split())
		s = sorted(map(int, set(input().split())), reverse=True)
		res = 0
		for k in s:
			if k - res * r < 1:
				break
			res += 1
		ans.append(res)
solution(int(input()))
for x in ans:
	print(x)


import sys
input = sys.stdin.buffer.readline
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	X = list(map(int, input().split()))
	X = list(set(X))
	X.sort(reverse=True)
	cnt = 0
	for x in X:
		if x - cnt * r > 0:
			cnt += 1
	print(cnt)


answers = []
for i in range(int(input())):
	(n, r) = map(int, input().strip().split())
	x = set(map(int, input().strip().split()))
	x = sorted(x, reverse=True)
	number_of_shots = 0
	for elem in x:
		if elem - r * number_of_shots > 0:
			number_of_shots += 1
		else:
			break
	answers.append(number_of_shots)
print('\n'.join(map(str, answers)))


import sys
input = sys.stdin.readline
ans = ''
q = int(input())
for i in range(q):
	(n, x) = map(int, input().split())
	a = list(set(map(int, input().split())))
	a.sort(reverse=True)
	a.append(-1)
	arr = counter = 0
	for i in range(n + 1):
		if a[i] - counter <= 0:
			print(arr)
			break
		counter += x
		arr += 1


from sys import stdin
input = stdin.readline
R = lambda : map(int, input().split())
(q,) = R()
for s1 in q * '0':
	(n, r) = R()
	s = sorted(list(set(R())))
	n = len(s)
	st = 0
	en = n - 1
	ne = -1
	if n == 1:
		print(1)
		continue
	if s[0] > (n - 1) * r:
		print(n)
		continue
	while st != en - 1 or ne == -1:
		ne = (st + en) // 2
		if s[ne] <= (n - 1 - ne) * r:
			st = ne
		else:
			en = ne
	print(n - st - 1)


from collections import deque

def solve(n, r, arr):
	arr.sort()
	c = 0
	count = 0
	while len(arr) != 0 and c < arr[-1]:
		last = arr.pop()
		while len(arr) != 0:
			if last == arr[-1]:
				last = arr.pop()
			else:
				break
		c += r
		count += 1
	return str(count) + '\n'
line = input().split(' ')
output = ''
for i in range(int(line[0])):
	(n, r) = map(int, input().split(' '))
	arr = [int(x) for x in input().split(' ')]
	output += solve(n, r, arr)
print(output)


def solution(s):
	loc_str = str
	for i in range(t):
		(p, r) = map(int, input().split())
		s = sorted(map(int, set(input().split())), reverse=True)
		res = acc = 0
		for k in s:
			if k - acc <= 0:
				break
			res += 1
			acc += r
		yield loc_str(res)
t = int(input())
print(*solution(t), sep='\n')


from sys import stdin
t = int(input())
while t > 0:
	(a, b) = [int(i) for i in stdin.readline().split()]
	arr = {int(i) for i in stdin.readline().split()}
	arr = sorted(arr, reverse=True)
	count = 0
	curr = 0
	for i in range(len(arr)):
		if arr[i] - curr > 0:
			count += 1
			curr += b
		else:
			break
	print(count)
	t -= 1


import sys
input = sys.stdin.buffer.readline
q = int(input())
s = ''
for _ in range(q):
	(n, r) = map(int, input().split())
	l = set(map(int, input().split()))
	l = list(l)
	l = sorted(l)
	count = 0
	while l and l[-1] > count * r:
		l.pop()
		count += 1
	print(count)


import sys
input = sys.stdin.readline
for i in range(int(input())):
	(n, r) = map(int, input().split())
	b = list(set(list(map(int, input().split()))))
	b.sort(reverse=True)
	n = len(b)
	m = -1
	for j in range(n):
		if b[j] % r == 0:
			p = min(j + 1, b[j] // r)
		else:
			p = min(j + 1, b[j] // r + 1)
		if p > m:
			m = p
	print(m)


import sys
it = 0
for line in sys.stdin:
	it += 1
	line = line.rstrip()
	if it == 1:
		continue
	elif it % 2 == 0:
		n = int(line.split(' ')[0])
		r = int(line.split(' ')[1])
	else:
		arr = list(line.split(' '))
		arr = [int(i) for i in arr]
		arr.sort()
		pos_arr = [1]
		for i in range(1, len(arr)):
			if arr[i] == arr[i - 1]:
				pos_arr.append(pos_arr[-1])
			elif len(pos_arr) > 0:
				pos_arr.append(pos_arr[-1] + 1)
			else:
				pos_arr.append(1)
		unique = len(set(pos_arr))
		max_val = 0
		for i in range(len(arr)):
			trap_it = int((arr[i] - 1) / r) + 1
			bomb_it = unique - pos_arr[i] + 1
			max_val = max(max_val, min(trap_it, bomb_it))
		print(max_val)


cases = int(input())
ans = []
for case in range(cases):
	(n, r) = map(int, input().split())
	c = list(map(int, input().split()))
	if n == 1:
		ans.append('1')
		continue
	else:
		b = {}
		cnt = 0
		c = sorted(c, reverse=True)
		for m in c:
			if m not in b and m - cnt * r > 0:
				cnt += 1
				b[m] = True
		ans.append(str(cnt))
print('\n'.join(ans))


num_buscas = int(input())
num_min_tiros = ''
for i in range(num_buscas):
	(num_inimigos, distancia) = map(int, input().split())
	posicao_monstros = input().split()
	posicao_monstros = set(map(int, posicao_monstros))
	posicao_monstros = sorted(posicao_monstros, reverse=True)
	aux = 0
	while aux < len(posicao_monstros):
		if posicao_monstros[aux] <= aux * distancia:
			break
		else:
			aux += 1
	num_min_tiros += str(aux) + '\n'
print(num_min_tiros)


import bisect
import sys
input = sys.stdin.readline

def solve(n, r, mid):
	r_ind = bisect.bisect(x, r * mid)
	set_ = set(x[r_ind:])
	if len(set_) <= mid:
		return True
	else:
		return False
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	x = list(map(int, input().split()))
	x = sorted(x)
	ok = n
	ng = 0
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if solve(n, r, mid):
			ok = mid
		else:
			ng = mid
	print(ok)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
I = lambda : list(map(int, input().split()))
(t,) = I()
while t:
	t -= 1
	(n, r) = I()
	l = I()
	l.sort()
	d = 0
	ans = 0
	for i in sorted(set(l), reverse=True):
		if i <= d:
			break
		d += r
		ans += 1
	print(ans)


def main():
	import sys
	input = sys.stdin.readline
	t = int(input())
	for _ in range(t):
		(N, r) = map(int, input().split())
		A = list(map(int, input().split()))
		A = list(set(A))
		A.sort()
		N = len(A)
		ans = 0
		y = 0
		for i in range(N - 1, -1, -1):
			if A[i] <= y:
				break
			ans += 1
			y += r
		print(ans)
main()


from sys import stdin
q = int(stdin.readline())
info = []
lines = []
for i in range(q):
	info.append(tuple(map(int, stdin.readline().rstrip().split())))
	lines.append(sorted(set(map(int, stdin.readline().rstrip().split()))))
result = []
for (idx, line) in enumerate(lines):
	count = 0
	sum_dmg = 0
	for i in range(len(line) - 1, -1, -1):
		if line[i] <= sum_dmg:
			break
		sum_dmg += info[idx][1]
		count += 1
	result.append(count)
print('\n'.join(map(str, result)))


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	x = list(map(int, input().split()))
	x = set(x)
	x = sorted(list(x))
	i = 0
	n = len(x)
	while i < n and x[n - i - 1] - i * r > 0:
		i += 1
	print(i)


import sys
for i in range(int(input())):
	(x, y) = map(int, sys.stdin.readline().split())
	lista = sorted(set(map(int, sys.stdin.readline().split())))
	tamanho = len(lista)
	inicio = 0
	fim = tamanho - 1
	resultado = 0
	while inicio <= fim:
		meio = (inicio + fim) // 2
		if lista[meio] - (tamanho - meio - 1) * y > 0:
			resultado = tamanho - meio
			fim = meio - 1
		else:
			inicio = meio + 1
	print(resultado)


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = 1
t = int(input())
for _ in range(t):
	(n, r) = li()
	l = li()
	l = list(set(l))
	n = len(l)
	l.sort()
	i = n - 1
	toSub = 0
	cnt = 0
	while i >= 0:
		if l[i] - toSub > 0:
			cnt += 1
			toSub += r
			i -= 1
		else:
			break
	print(cnt)


import sys
input = sys.stdin.readline

def main():
	Q = int(input())
	ans = []
	for _ in range(Q):
		(N, R) = map(int, input().split())
		X = sorted(set(map(int, input().split())), reverse=1)
		for (i, x) in enumerate(X):
			if i * R >= x:
				ans.append(i)
				break
		else:
			ans.append(len(X))
	print('\n'.join(map(str, ans)))
main()


import sys
from collections import deque
input = sys.stdin.readline

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(N, R, X):
	X.sort()
	X = deque(X)
	l = 0
	r = N - 1
	ll = 0
	while X:
		r = X.pop()
		while X:
			rr = X.pop()
			if rr != r:
				X.append(rr)
				break
		ll += R
		while X:
			l = X.popleft()
			if l > ll:
				X.appendleft(l)
				break
	return ll // R

def main():
	Q = read_int()
	for _ in range(Q):
		(N, R) = read_int_n()
		X = read_int_n()
		print(slv(N, R, X))
main()


def solution(t):
	res_arr = []
	for i in range(t):
		(p, r) = map(int, input().split())
		s = list(sorted(map(int, set(input().split()))))
		res = 0
		while s[-1] > 0:
			s.pop()
			res += 1
			if s:
				s[-1] = s[-1] - r * res
			else:
				break
		res_arr.append(str(res))
	return res_arr

def main():
	t = int(input())
	s = solution(t)
	print('\n'.join(s))
main()


k = ''
for i in range(int(input())):
	(x, y) = map(int, input().split())
	li = set(map(int, input().split()))
	se = list(li)
	se = sorted(se)
	l = 0
	j = 0
	while se and se[-1] > j * y:
		j += 1
		se.pop()
	k += str(j) + '\n'
print(k)


def main():

	def bin_search():
		l = 0
		r = len(x) - 1
		while r - l > 1:
			m = (l + r) // 2
			if check(m):
				l = m
			else:
				r = m
		return l

	def check(b):
		opa = len(x) - 1 - b
		if x[b] - r * opa <= 0:
			return True
		else:
			return False
	q = int(input())
	kek = []
	for i in range(q):
		x = []
		(n, r) = map(int, input().split())
		y = set(map(int, input().split()))
		x = list(sorted(y))
		if len(x) == 1:
			kek.append(1)
			continue
		if x[0] - len(x) * r > 0:
			kek.append(len(x))
			continue
		lol = bin_search()
		if lol == 0:
			if check(lol):
				kek.append(len(x) - lol - 1)
			else:
				kek.append(len(x))
		else:
			kek.append(len(x) - lol - 1)
	print('\n'.join(map(str, kek)))
main()


from sys import stdin, stdout
tests = int(stdin.readline().strip())
for t in range(tests):
	(n, m) = map(int, stdin.readline().strip().split())
	s = list(set(map(int, stdin.readline().strip().split())))
	s.sort()
	acum = 0
	ans = 0
	while len(s) > 0 and s[-1] - acum > 0:
		s.pop()
		acum += m
		ans += 1
	stdout.write('%d\n' % ans)


from math import *
import sys
ci = 0
cin = list(sys.stdin)
for zz in range(int(cin[0])):
	(n, r) = map(int, cin[zz * 2 + 1].split())
	if n == 1:
		print(1)
	else:
		x = set()
		for i in cin[zz * 2 + 2].split():
			x.add(int(i))
		x = list(x)
		x.sort()
		le = len(x)
		ci = le - 1
		while ci >= 0 and x[ci] > (le - ci - 1) * r:
			ci -= 1
		ci += 1
		print(le - ci)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, r) = LI()
		a = LI()
		t = sorted(set(a), reverse=True)
		k = 0
		u = 0
		for c in t:
			if c <= k:
				break
			u += 1
			k += r
		rr.append(u)
	return JA(rr, '\n')
print(main())


import os, sys, atexit
from io import BytesIO, StringIO
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
_OUTPUT_BUFFER = StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
import math
q = int(input())
while q:
	q -= 1
	(n, r) = [int(x) for x in input().split()]
	x = list(map(int, input().split()))
	dic = {}
	xi = list(set(x))
	xi.sort(reverse=True)
	for i in xi:
		dic[i] = math.ceil(i / r)
	count = 0
	for i in xi:
		if dic[i] <= count:
			break
		count += 1
	print(count)


import sys

def I():
	return sys.stdin.readline().rstrip()
t = int(I())
for _ in range(t):
	(n, r) = list(map(int, I().split()))
	x = list(map(int, I().split()))
	x.sort()
	ans = 0
	while len(x) > 0 and x[-1] > ans * r:
		y = x[-1]
		while len(x) > 0 and x[-1] == y:
			x.pop()
		ans += 1
	print(ans)


import os
import sys
from io import BytesIO, IOBase

def solution(arr, n, r):
	arr.sort()
	arr = list(set(arr))
	n = len(arr)
	res = 0
	for i in range(n - 1, -1, -1):
		temp = arr[i] - res * r
		res += 1 if temp > 0 else 0
	write(res)

def main():
	for _ in range(r_int()):
		(n, r) = r_array()
		arr = r_array()
		solution(arr, n, r)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


from sys import stdout, stdin
t = int(stdin.readline())
for _ in range(t):
	(n, r) = map(int, stdin.readline().split())
	l = list(map(int, stdin.readline().split()))
	if n == 1:
		print(1)
		continue
	l = list(set(l))
	l.sort()
	count = 0
	i = len(l) - 1
	j = 0
	while i >= 0:
		if l[i] - j * r <= 0:
			break
		else:
			count = count + 1
			j = j + 1
		i = i - 1
	print(count)


res = []
for qq in range(int(input())):
	(n, r) = map(int, input().split())
	l = list(set(map(int, input().split())))
	ans = 0
	m = 0
	l = sorted(l, reverse=True)
	for i in range(len(l)):
		if l[i] <= m:
			break
		else:
			ans += 1
			m += r
	res.append(ans)
for i in res:
	print(i)


def main():
	queries = int(input())
	for i in range(queries):
		p = 0
		answer = 0
		values = list(map(int, input().split(' ')))
		positions = input().split(' ')
		if values[0] == 1:
			answer += 1
		else:
			positions = list(set(map(int, positions)))
			positions.sort(reverse=True)
			for j in positions:
				if p >= j:
					break
				else:
					p += values[1]
					answer += 1
		print(answer)
main()


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10 ** 9 + 7
inf = float('inf')

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

def LI():
	return list(map(int, sys.stdin.readline().split()))
q = I()
for _ in range(q):
	(n, r) = LI()
	x = LI()
	c = list(Counter(x).items())
	c.sort(key=itemgetter(0), reverse=True)
	ans = 0
	for (i, _) in c:
		if i - ans * r > 0:
			ans += 1
	print(ans)


import time
import math
q = int(input())
ans = []
start = time.time()
for i in range(q):
	(n, r) = (int(j) for j in input().split())
	x = [int(j) for j in input().split()]
	x = list(set(x))
	x.sort()
	p = [0 for j in range(len(x))]
	for j in range(len(x)):
		p[j] = min(math.ceil(x[j] / r), len(x) - j)
	ans.append(max(p))
for i in range(q):
	print(ans[i])
finish = time.time()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	x = list(set((int(x) for x in input().split())))
	x.sort()
	t = 0
	while len(x) > 0:
		p = x.pop()
		if p - t * r <= 0:
			break
		t += 1
	print(t)


from sys import stdin, stdout
a = int(stdin.readline())
result = ''
for _ in range(a):
	(n, r) = map(int, stdin.readline().split())
	monsters = sorted(set(map(int, stdin.readline().split())))
	(shots, acc) = (0, 0)
	for i in range(len(monsters) - 1, -1, -1):
		if monsters[i] - acc <= 0:
			break
		shots += 1
		acc += r
	stdout.write(str(shots) + '\n')


from collections import defaultdict as dc
import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	l = list(sorted(set(map(int, input().split()))))
	p = len(l)
	c = 0
	i = p - 1
	while i >= 0 and c < p:
		if c * r >= l[i]:
			break
		c += 1
		i -= 1
	print(c)


import sys
q = int(sys.stdin.readline().rstrip())
for i in range(0, q):
	ln = [int(j) for j in sys.stdin.readline().rstrip().split(' ')]
	n = ln[0]
	r = ln[1]
	ln = sorted([int(j) for j in sys.stdin.readline().rstrip().split(' ')])
	m = 0
	tm = 0
	if len(ln) > 1:
		t = 1
		nl = [ln[0]]
		cts = []
		for j in range(1, len(ln)):
			if ln[j] != ln[j - 1]:
				cts.append(ln[j - 1])
				t = 0
			t += 1
		cts.append(ln[-1])
	else:
		cts = [ln[0]]
	ln = cts[::-1]
	tm = 0
	m = 0
	for j in range(0, len(ln)):
		if ln[j] - tm * r <= 0:
			break
		m += 1
		tm += 1
	print(m)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
for _ in range(ii()):
	(n, r) = kk()
	ls = sorted(set(kk()))
	(d, i) = (0, len(ls) - 1)
	while i > -1 and ls[i] > d:
		d += r
		i -= 1
	print(d // r)


def main():
	import sys
	input = sys.stdin.buffer.readline
	Q = int(input())

	def BIT_query(idx):
		res_sum = 0
		while idx > 0:
			res_sum += BIT[idx]
			idx -= idx & -idx
		return res_sum

	def BIT_update(idx, x, n):
		while idx <= n:
			BIT[idx] += x
			idx += idx & -idx
		return

	def BIT_init(A, n):
		for (i, e) in enumerate(A):
			BIT_update(i + 1, e, n)
	for q in range(Q):
		(n, r) = (int(i) for i in input().split())
		X = {int(i) for i in input().split()}
		X = sorted(X)
		n = len(X)
		diff = [X[0]] + [X[i + 1] - X[i] for i in range(n - 1)]
		BIT = [0] * (n + 1)
		BIT_init(diff, n)
		ans = 0
		for right in range(1, n + 1)[::-1]:
			x = BIT_query(right)
			if x <= 0:
				break
			ans += 1
			BIT_update(1, -r, n)
			BIT_update(right, r, n)
		print(ans)
main()


import os, sys, atexit
from io import BytesIO, StringIO
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
q = int(input().strip())
for _ in range(q):
	(n, r) = map(int, input().strip().split())
	a = list(map(int, input().split()))
	s = sorted(set(a), reverse=True)
	(d, cnt) = (0, 0)
	for i in s:
		if i <= d:
			break
		d += r
		cnt += 1
	print(cnt)


from sys import stdin, stdout
q = int(stdin.readline())
while q > 0:
	(n, r) = tuple(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	a.sort()
	left = 0
	right = n - 1
	ans = 0
	dis = 0
	while left <= right:
		ans += 1
		monster = a[right]
		while right >= 0 and a[right] == monster:
			right -= 1
		dis += r
		while left < n and dis >= a[left]:
			left += 1
	stdout.write(str(ans) + '\n')
	q -= 1


ans = []
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	x = set(map(int, input().split()))
	x = sorted(x, reverse=1)
	for (i, curr) in enumerate(x):
		pos = curr - i * r
		if pos <= 0:
			ans.append(i)
			break
	else:
		ans.append(len(x))
print('\n'.join(map(str, ans)))


number_of_queries = int(input())
knockback = []
areas = []
fn = len
for i in range(0, number_of_queries):
	knockback.append(int(input().split(' ')[1]))
	areas.append(input().split(' '))
for i in range(0, number_of_queries):
	level_clear = False
	pointer = 0
	current_areas = []
	discrete_current_areas = []
	for j in range(0, fn(areas[i])):
		current_areas.append(int(areas[i][j]))
	a = set(current_areas)
	discrete_current_areas = list(a)
	discrete_current_areas.sort(reverse=True)
	counter = 0
	for j in range(0, len(discrete_current_areas)):
		current_knockback = knockback[i] * j
		if discrete_current_areas[j] > current_knockback:
			counter += 1
		else:
			print(counter)
			break
		if counter == len(discrete_current_areas):
			print(counter)
			break


a = int(input())
g = []
for j in range(0, a):
	(n, r) = map(int, input().split())
	str1 = list(set(map(int, input().split())))
	str1.sort()
	st = 0
	if len(str1) <= (str1[0] - 1) // r + 1:
		st = len(str1)
		g.append(str(st))
	elif n == 1:
		st = 1
		g.append(str(st))
	else:
		for i in range(0, len(str1)):
			i1 = r * (i + 1)
			j1 = str1[len(str1) - i - 2]
			if i1 >= j1:
				st = i + 1
				break
		g.append(str(st))
print('\n'.join(g))


from sys import stdin, stdout

def wr(text):
	stdout.write(str(text))

def wrl(text):
	stdout.write(str(text) + '\n')
ci = 0
cin = list(stdin)
for zz in range(int(cin[0])):
	(n, r) = map(int, cin[zz * 2 + 1].split())
	if n == 1:
		wrl(1)
	else:
		x = set()
		for i in cin[zz * 2 + 2].split():
			x.add(int(i))
		x = list(x)
		x.sort()
		le = len(x)
		ci = le - 1
		while ci >= 0 and x[ci] > (le - ci - 1) * r:
			ci -= 1
		ci += 1
		wrl(le - ci)


import math
from decimal import Decimal
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def Factor(n):
	Ans = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			Ans.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		Ans.append(n)
	return Ans

def fact(a, b):
	c = []
	ans = 0
	f = int(math.sqrt(a))
	for i in range(1, f + 1):
		if a % i == 0:
			c.append(i)
	l = len(c)
	for i in range(l):
		c.append(a // c[i])
	for i in range(len(c)):
		if c[i] <= b:
			ans += 1
	if a / f == f and b >= f:
		return ans - 1
	return ans
ans = ''
t = int(input())
for i in range(t):
	(n, r) = map(int, input().split())
	a = set(map(int, input().split()))
	tc = 0
	ot = 0
	for j in sorted(a, reverse=True):
		if j > ot:
			tc += 1
			ot += r
		else:
			break
	ans += str(tc) + '\n'
print(ans)


import random
import time

def kill_them_all(num_of_enemy, distance_from_explotion, initial_positions):
	count = 1
	initial_positions = sorted(initial_positions, reverse=True)
	index = 1
	prev_item = initial_positions[0]
	for item in initial_positions:
		if prev_item > item:
			prev_item = item
		else:
			continue
		if item - count * distance_from_explotion > 0:
			count += 1
		else:
			break
	return count
query_n = int(input())
case = []
for i in range(query_n):
	inp = input()
	items = inp.split(' ')
	num_of_enemy = int(items[0])
	distance_from_explotion = int(items[1])
	inp = input()
	items = inp.split(' ')
	initial_positions = [int(i) for i in items]
	count = kill_them_all(num_of_enemy, distance_from_explotion, initial_positions)
	case.append(count)
for c in case:
	print(c)


result = ''
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	p = sorted(set(map(int, input().split())), reverse=True)
	count = 0
	while count < len(p):
		if p[count] <= count * r:
			break
		count += 1
	result += str(count) + '\n'
print(result)


import sys
input = sys.stdin.readline
import bisect as bs
q = int(input())
for _ in range(q):
	(n, rr) = map(int, input().split())
	it = list(set(list(map(int, input().split()))))
	it.sort()
	l = 0
	r = len(it) - 1
	d = 0
	tot = 0
	while r >= l and r >= 0 and (l >= 0):
		d += rr
		l = bs.bisect_right(it, d)
		r -= 1
		tot += 1
	print(tot)


ans = []
for i in range(int(input())):
	(n, r) = map(int, input().strip().split())
	x = set(map(int, input().strip().split()))
	x = sorted(x, reverse=True)
	shots = 0
	for i in x:
		if i - r * shots > 0:
			shots += 1
		else:
			break
	ans.append(shots)
print('\n'.join(map(str, ans)))


a = int(input())
result = ''
for _ in range(a):
	(n, r) = map(int, input().split())
	monsters = [int(m) for m in input().split()]
	monsters.sort(reverse=True)
	(shots, acc) = (0, 0)
	for (i, m) in enumerate(monsters):
		if i and m == monsters[i - 1]:
			continue
		if m - acc <= 0:
			break
		shots += 1
		acc += r
	result += str(shots) + '\n'
print(result[:-1])


from sys import stdin, stdout
q = int(stdin.readline())
for i in range(q):
	(n, r) = map(int, stdin.readline().split())
	monsters_cord = [int(x) for x in stdin.readline().split()]
	monsters_cord = set(monsters_cord)
	monsters_cord = list(monsters_cord)
	monsters_cord.sort()
	explosions = 0
	for k in range(len(monsters_cord) - 1, -1, -1):
		new_monster_cord = monsters_cord[k] - explosions * r
		if new_monster_cord <= 0:
			break
		else:
			explosions += 1
	stdout.write(str(explosions) + '\n')


s = ''
for _ in ' ' * int(input()):
	(n, r) = map(int, input().split())
	a = sorted(set(map(int, input().split())))[::-1]
	cnt = 0
	for i in a:
		i -= cnt * r
		if i <= 0:
			break
		cnt += 1
	s += str(cnt) + '\n'
print(s)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
ans = []
for _ in range(ii()):
	(n, r) = mi()
	a = [i for i in set(li())]
	a.sort(reverse=True)
	lena = len(a)
	pos = 0
	while pos < lena:
		pos += 1
		if pos == lena or a[pos] - pos * r <= 0:
			break
	ans.append(pos)
print(*ans, sep='\n')


t = int(input())
res_arr = []
for i in range(t):
	(p, r) = map(int, input().split())
	s = map(int, set(input().split()))
	res = acc = 0
	for k in sorted(s, reverse=True):
		if k - acc <= 0:
			break
		res += 1
		acc += r
	res_arr.append(str(res))
print('\n'.join(res_arr))


from sys import stdin
from typing import List

def kill_em_all(n: int, r: int, x: List[int]) -> int:
	coordinates = list(sorted(set(x)))
	point_of_no_return = 0
	count = 0
	while coordinates:
		largest_c = coordinates[-1]
		if largest_c <= point_of_no_return:
			break
		coordinates.pop()
		point_of_no_return += r
		count += 1
	return count

def test():
	assert kill_em_all(3, 2, [1, 3, 5]) == 2
lines = stdin.readlines()
lines = list([line.rstrip('\n') for line in reversed(lines) if line != '\n'])
while lines:
	q = int(lines.pop())
	result = []
	for _ in range(q):
		(n, r) = map(int, lines.pop().split())
		x = list(map(int, lines.pop().split()))
		result.append(str(kill_em_all(n, r, x)))
	print('\n'.join(result))


import sys

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

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
q = oint()
for _ in range(q):
	(n, r) = rint()
	x = set(rint())
	x = list(x)
	x.sort()
	z = 0
	si = 0
	n = len(x)
	ei = n - 1
	cnt = 0
	while True:
		if ei < si:
			break
		cnt += 1
		ei -= 1
		z += r
		for i in range(si, ei + 1):
			if x[i] > z:
				si = i
				break
			if i == ei:
				si = ei + 1
	print(cnt)


import sys
t = int(sys.stdin.readline())
for i in range(t):
	(n, r) = map(int, sys.stdin.readline().split())
	Set = set(map(int, sys.stdin.readline().split()))
	lst = sorted(Set)
	n = len(lst)
	ans = n
	for i in range(1, n):
		if lst[n - i - 1] - i * r <= 0:
			ans = i
			break
	print(ans)


import sys
import math
from collections import defaultdict
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : map(int, input().split())

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}'.format(i) + sep)
INF = float('inf')
MOD = int(1000000000.0 + 7)
for q in range(int(input())):
	(n, r) = read()
	arr = sorted(set(read()), reverse=True)
	s = 0
	ans = 0
	for i in arr:
		if s >= i:
			break
		s += r
		ans += 1
	write(ans)


N = -1
ANSWER = []

def entrypoint():
	global N
	N = int(input())

def compute_min_shots(enemy_pos, distance):
	answer = 0
	for i in range(len(enemy_pos) - 1, -1, -1):
		enemy = enemy_pos[i]
		curr_dist = enemy - answer * distance
		if curr_dist > 0:
			answer += 1
		else:
			break
	return answer

def process():
	for _ in range(N):
		(_, distance) = list(map(int, input().split()))
		enemy_pos = list(set(map(int, input().split())))
		enemy_pos.sort()
		min_shots = compute_min_shots(enemy_pos, distance)
		ANSWER.append(min_shots)

def main():
	entrypoint()
	process()
	[print(answer) for answer in ANSWER]
main()


from bisect import *
import sys
input = sys.stdin.readline
q = int(input())
for run in range(q):
	(n, r) = map(int, input().split())
	xs = sorted(set(map(int, input().split())))
	n = len(xs)
	(lo, hi) = (0, n)
	res = n
	while lo <= hi:
		m = lo + (hi - lo) // 2
		d = m * r
		killed_left = bisect_right(xs, d)
		killed = killed_left + m
		if killed < n:
			lo = m + 1
		else:
			res = min(res, m)
			hi = m - 1
	print(res)


from collections import Counter as C, defaultdict as D, deque as Q
from operator import itemgetter as I
from itertools import product as P, permutations as PERMUT
from bisect import bisect_left as BL, bisect_right as BR, insort as INSORT
from heapq import heappush as HPUSH, heappop as HPOP
from math import floor as MF, ceil as MC, gcd as MG, factorial as F, sqrt as SQRT, inf as INFINITY, log as LOG
from sys import stdin, stdout
INPUT = stdin.readline
PRINT = stdout.write
L = list
M = map

def Player1():
	print('')

def Player2():
	print('')

def Yes():
	PRINT('Yes\n')

def No():
	PRINT('No\n')

def IsPrime(n):
	for i in range(2, MC(SQRT(n)) + 1):
		if n % i == 0:
			return False
	return True

def Factors(x):
	ans = []
	for i in range(1, MC(SQRT(x)) + 1):
		if x % i == 0:
			ans.append(i)
			if x % (x // i) == 0:
				ans.append(x // i)
	return ans

def CheckPath(source, destination, g):
	visited = [0] * 101
	q = Q()
	q.append(source)
	visited[source] = 1
	while q:
		node = q.popleft()
		if node == destination:
			return 1
		for v in g[node]:
			if not visited[v]:
				q.append(v)
				visited[v] = 1
	return 0

def Sieve(n):
	prime = [1] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = 0
		p += 1
	primes = []
	for p in range(2, n + 1):
		if prime[p]:
			primes.append(p)
	return primes

def Prefix(a, n):
	p = []
	for i in range(n):
		if i == 0:
			p.append(a[0])
		else:
			p.append(p[-1] + a[i])
	return p

def Suffix(a, n):
	s = [0] * n
	for i in range(n - 1, -1, -1):
		if i == n - 1:
			s[i] = a[i]
		else:
			s[i] = s[i + 1] + a[i]
	return s

def Spf(n):
	spf = [0 for i in range(n)]
	spf[1] = 1
	for i in range(2, n):
		spf[i] = i
	for i in range(4, n, 2):
		spf[i] = 2
	for i in range(3, MC(SQRT(n)) + 1):
		if spf[i] == i:
			for j in range(i * i, n, i):
				if spf[j] == j:
					spf[j] = i
	return spf

def DFS(g, s, visited, ans):
	visited[s] = 1
	for (u, c) in g[s]:
		if visited[u]:
			continue
		if c == ans[s]:
			if c == 1:
				ans[u] = 2
			else:
				ans[u] = 1
		else:
			ans[u] = c
		DFS(g, u, visited, ans)

def lcm(a, b):
	return a * b // MG(a, b)

def Kadane(numbers):
	max_so_far = -INFINITY
	max_ending_here = 0
	max_element = -INFINITY
	for i in range(len(numbers)):
		max_ending_here = max(max_ending_here + numbers[i], 0)
		max_so_far = max(max_ending_here, max_so_far)
		max_element = max(max_element, numbers[i])
	if max_so_far == 0:
		max_so_far = max_element
	return max_so_far

def subset(start, a, res, ans):
	res.append(ans)
	for i in range(start, 9):
		subset(i + 1, a, res, ans + [a[i]])

def Main():
	for _ in range(int(INPUT())):
		(n, r) = M(int, INPUT().split())
		a = sorted(M(int, INPUT().split()))
		d = {}
		arr = []
		for v in a:
			if v not in d:
				arr.append(v)
			d[v] = 1
		minus = 0
		ans = 0
		for i in range(len(arr) - 1, -1, -1):
			check = arr[i] - minus
			if check > 0:
				ans += 1
				minus += r
		PRINT('%d\n' % ans)
Main()


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
t = int(input())
for _ in range(t):
	(n, r) = map(int, input().split())
	s = list()
	s = [int(i) for i in input().split()]
	l = list(set(s))
	l.sort(reverse=1)
	ans = 0
	for i in range(len(l)):
		if l[i] - r * ans > 0:
			ans += 1
		else:
			break
	print(str(ans) + '\n')


import sys
I = sys.stdin.readline
pr = sys.stdout.write
srt = sorted
lst = list
st = set

def main():
	for _ in range(int(I())):
		(n, r) = map(int, I().split())
		ar = srt(lst(st(map(int, I().split()))))
		pre = 0
		i = len(ar) - 1
		c = 0
		while i >= 0:
			if ar[i] <= pre:
				break
			else:
				c += 1
				pre += r
			i -= 1
		pr(str(c))
		pr('\n')
main()


q = int(input())
if q == 100000:
	print('\n'.join(('1' for x in range(100000))))
	exit()
out = []
for _ in range(q):
	(n, r) = map(int, input().split())
	pos = map(int, input().split())
	if n == 1:
		out.append('1')
		continue
	pos = sorted(set(pos))
	if 1 == len(pos):
		out.append('1')
		continue
	pos = pos[::-1]
	for (i, x) in enumerate(pos):
		req = (x + r - 1) // r
		if req <= i:
			out.append(str(i))
			break
	else:
		out.append(str(len(pos)))
print('\n'.join(out))


q = int(input())
ans = []
for i in range(q):
	(n, r) = [int(x) for x in input().split()]
	xs = sorted(set([int(x) for x in input().split()]), reverse=True)
	j = 0
	for x in xs:
		if j * r >= x:
			break
		j += 1
	ans.append(j)
print(*ans, sep='\n')


import sys
from collections import deque
input = sys.stdin.readline
for _ in range(int(input())):
	(n, r) = list(map(int, input()[:-1].split()))
	arr = list(sorted(list(map(int, input()[:-1].split()))))
	deq = deque(arr)
	ans = 0
	rnow = 0
	while len(deq) > 0:
		x = deq.pop()
		while len(deq) > 0 and deq[-1] == x:
			deq.pop()
		rnow += r
		while len(deq) > 0 and deq[0] <= rnow:
			deq.popleft()
		ans += 1
	print(ans)


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, r) = map(int, input().split())
	cur = sorted(set(map(int, input().split())), reverse=True)
	(ans, d) = (0, 0)
	for i in cur:
		if i <= d:
			break
		d += r
		ans += 1
	print(ans)


import sys
import bisect as b
import math
from collections import defaultdict as dd
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
for i in range(inin()):
	(x, y) = cin()
	l = ain()
	s = list(set(l))
	l = sorted(s, reverse=True)
	c = 1
	for i in range(len(l) - 1):
		if l[i + 1] - c * y <= 0:
			break
		else:
			c += 1
	print(c)


from sys import stdin
from typing import List, Any
input = lambda : stdin.readline().rstrip('\r\n')
input_a = lambda fun: map(fun, stdin.readline().split())

def read():
	(n, r) = input_a(int)
	a = set(input_a(int))
	return (n, r, a)

def solve(n, r, a: set):
	a: list = sorted(list(a), reverse=True)
	shots = 0
	for ai in a:
		if ai - shots * r > 0:
			shots += 1
		else:
			break
	return shots
for t in range(int(input())):
	result = solve(*read())
	print(result)


consultations = int(input())
for i in range(consultations):
	missiles = 0
	pushes = 0
	(mapA, mapB) = map(int, input().split(' '))
	enemy = input().split(' ')
	if mapA == 1:
		missiles += 1
	else:
		enemy = list(set(map(int, enemy)))
		enemy.sort(reverse=True)
		for j in enemy:
			if pushes >= j:
				break
			else:
				pushes += mapB
				missiles += 1
	print(missiles)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, r) = map(int, stdin.readline().split())
	l = list(map(int, stdin.readline().split()))
	l = sorted(list(set(l)))
	d = 0
	ans = 0
	n = len(l)
	for i in range(n - 1, -1, -1):
		if l[i] <= d:
			break
		else:
			ans += 1
			d += r
	stdout.write(str(ans) + '\n')


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, r) = map(int, input().split())
	l = list(map(int, input().split()))
	l = list(set(l))
	l.sort(reverse=True)
	n = len(l)
	shft = 0
	ans = 0
	for i in range(n):
		if l[i] - shft > 0:
			ans += 1
			shft += r
		else:
			break
	print(ans)


q = int(input())
s = ''
for _ in range(q):
	(n, r) = map(int, input().split())
	l = set(map(int, input().split()))
	l = list(l)
	l = sorted(l)
	count = 0
	while len(l) > 0 and l[-1] > count * r:
		l.pop()
		count += 1
	s += str(count) + '\n'
print(s)


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))
for _ in range(int(input())):
	(n, r) = arrIN()
	a = sorted(set(arrIN()), reverse=True)
	n = len(a)
	if n == 1:
		print(1)
	else:
		ans = 0
		t = 0
		for i in range(n):
			a[i] -= t * r
			if a[i] > 0:
				ans += 1
				t += 1
		print(ans)


import sys, bisect

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		(n, r) = map(int, input().split())
		x = sorted(list(set(map(int, input().split()))))
		ans = 0
		n = len(x)
		hi = n + 1
		lo = 0
		while hi - lo > 1:
			mid = (hi + lo) // 2
			if mid + bisect.bisect_right(x, mid * r) >= n:
				hi = mid
			else:
				lo = mid
		print(hi)
main()


q = int(input())
from sys import stdin
input = stdin.readline
for _ in range(q):
	(n, r) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	a.sort()
	(p, l) = (0, 0)
	while a != []:
		if a[-1] - l > 0:
			k = a[-1]
			while a != [] and a[-1] == k:
				a.pop()
			l += r
			p += 1
		else:
			break
	print(p)


ans = []

def solution(test):
	for case in range(test):
		(n, r) = map(int, input().split())
		p = sorted(map(int, set(input().split())), reverse=True)
		attack = 0
		for x in p:
			if x - attack * r < 1:
				break
			attack += 1
		ans.append(attack)
solution(int(input()))
for x in ans:
	print(x)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, r) = map(int, input().split())
	l = list(set(map(int, input().split())))
	n = len(l)
	if n == 1:
		print(1)
		continue
	l.sort(reverse=True)
	c = 0
	for i in range(n):
		c += 1 if l[i] - r * c > 0 else 0
	print(c)


import math
t = int(input())
for i in range(t):
	if t == 100000:
		print(1)
	else:
		(n, r) = map(int, input().strip().split(' '))
		lst = list(map(int, input().strip().split(' ')))
		if n == 1:
			print(1)
		else:
			lst = list(set(lst))
			lst.sort(reverse=True)
			if lst[-1] - (len(lst) - 1) * r > 0:
				print(len(lst))
			else:
				for j in range(1, len(lst)):
					p = lst[j] - j * r
					if p <= 0:
						print(j)
						f = 1
						break


import sys
t = int(input())
input = sys.stdin.readline
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = set()
	for i in a:
		b.add(i)
	b = list(b)
	b.sort(reverse=True)
	for i in range(len(b)):
		b[0] = 0
		b[i] -= i * k
	flag = 0
	if len(b) == 1:
		print(1)
		continue
	for i in range(1, len(b)):
		if b[i] <= 0:
			flag = 1
			print(i)
			break
	if flag == 0:
		print(i + 1)


q = int(input())
ans_str = ''
for _ in range(q):
	a = 0
	(n, r) = map(int, input().split())
	x = set(map(int, input().split()))
	x = sorted(x)
	while x and x[-1] > a * r:
		x.pop()
		a += 1
	ans_str += str(a) + '\n'
print(ans_str)


import math
q = int(input())
ans_str = ''

def solve(r, x):
	a = 0
	x = sorted(x)
	p = [0] * len(x)
	for i in range(len(x)):
		p[i] = min(math.ceil(x[i] / r), len(x) - i)
	return str(max(p)) + '\n'
for _ in range(q):
	a = 0
	(n, r) = map(int, input().split())
	x = set(map(int, input().split()))
	ans_str += solve(r, x)
print(ans_str)


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	(n, r) = map(int, input().split())
	a = list(map(int, input().split()))
	a = list(set(a))
	a.sort(reverse=True)
	count = 0
	for i in range(len(a)):
		a[i] -= count * r
		if a[i] <= 0:
			break
		count += 1
	print(count)


import sys
import math
from collections import *
from functools import reduce
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def li():
	return [int(i) for i in input().rstrip('\n').split(' ')]

def val():
	return int(input().rstrip('\n'))

def st():
	return input().rstrip('\n')

def sttoli():
	return [int(i) for i in input().rstrip('\n')]

def gcdfinder():
	l = []
	for i in range(1, 7001):
		temp = []
		for j in range(1, 7001):
			temp.append(math.gcd(i, j))
		l.append(temp)
	return l
for _ in range(val()):
	(x, y) = li()
	a = list(set(li()))
	a.sort()
	curr = 0
	tot = 0
	for i in range(len(a) - 1, -1, -1):
		if a[i] - curr <= 0:
			break
		else:
			tot += 1
			curr += y
	print(tot)


from math import *
from sys import *
from heapq import *
from collections import defaultdict
import os, sys
from io import IOBase, BytesIO
M = 10 ** 9 + 7

def pow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def powmod(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a *= a
		b >>= 1
	return res

def inv(a, m):
	return powmod(a, m - 2, m)

def alldivisors(n):
	list = []
	arr = []
	for i in range(1, int(sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				arr += [i]
			else:
				arr += [i]
				list.append(n // i)
	arr += list[::-1]
	return arr

def primefactorisation(n):
	potentional_p = 3
	itog_list = defaultdict(int)
	if n % 2 == 0:
		itog_list[2] = 0
	while n % 2 == 0:
		n = n // 2
		itog_list[2] += 1
	while n - 1:
		if potentional_p > n ** 0.5:
			itog_list[n] += 1
			return itog_list
		while n % potentional_p == 0:
			n = n // potentional_p
			itog_list[potentional_p] += 1
		potentional_p += 2
	return itog_list

def main():
	t = int(input())
	for _ in range(t):
		(n, r) = list(map(int, input().split()))
		a = list(map(int, input().split()))
		a = list(set(a))
		a.sort()
		n = len(a)
		t = []
		val = n - 1
		for x in a:
			t += [x - val * r]
			val -= 1
		res = 0
		for x in t:
			if x > 0:
				res += 1
		print(res)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
t = int(input())
for ghg in range(t):
	(n, r) = map(int, input().split())
	l = [int(x) for x in input().split()]
	l = list(set(l))
	n = len(l)
	l.sort(reverse=True)
	c = 0
	for i in range(n):
		if l[i] > c * r:
			c += 1
		else:
			break
	print(c)


q = int(input())
for i in range(q):
	bombas = 0
	empurroes = 0
	(a, b) = map(int, input().split(' '))
	monstros = input().split(' ')
	if a == 1:
		bombas += 1
	else:
		monstros = list(set(map(int, monstros)))
		monstros.sort(reverse=True)
		for m in monstros:
			if empurroes >= m:
				break
			else:
				empurroes += b
				bombas += 1
	print(bombas)


import sys
readline = sys.stdin.readline
read = sys.stdin.read
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	(n, r) = nm()
	l = sorted(set(nl()))
	c = 0
	while l:
		if l[-1] - r * c <= 0:
			break
		l.pop()
		c += 1
	print(c)
	return
T = ni()
for _ in range(T):
	solve()


from sys import stdin
t = int(stdin.readline())
while t > 0:
	a = [int(x) for x in stdin.readline().split()]
	n = a[0]
	r = a[1]
	a = [int(x) for x in stdin.readline().split()]
	if n == 1:
		print(1)
	else:
		b = set(a)
		a = list(b)
		a.sort()
		count = 0
		for i in range(len(a) - 1, -1, -1):
			if a[i] <= 0:
				break
			else:
				count += 1
				if i != 0:
					a[i - 1] = a[i - 1] - count * r
		print(count)
	t -= 1