Ved started playing a new mobile game called Fighting Clans. An army of N enemies is approaching his base. The i^{th} enemy has H_{i} health points. An enemy gets killed if his health points become 0.  
Ved defends his base using a weapon named Inferno. He can set the Inferno to one of the following two modes:
Single-Target Mode: In one second, the Inferno can target exactly one living enemy and cause damage of at most X health points.
Multi-Target Mode: In one second, the Inferno can target all living enemies and cause damage of 1 health point to each of them.

Find the minimum time required to kill all the enemies.

Note: Ved is not allowed to change the mode of the weapon once it is set initially.

------ Input Format ------ 

- The first line contains a single integer T - the number of test cases. Then the test cases follow.
- The first line of each test case contains two integers N and X - the number of enemies and the damage caused by the single-target mode of Inferno in one second respectively.
- The second line of each test case contains N space-separated integers H_{1}, H_{2}, \dots, H_{N} where H_{i} denotes the initial health points of i^{th} enemy.

------ Output Format ------ 

For each test case, output in a single line, the minimum time required to kill all the enemies.

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

$1 ≤ T ≤ 1000$
$1 ≤ N ≤ 200$
$1 ≤X ≤100$
$1 ≤A_{i} ≤100$

----- Sample Input 1 ------ 
4
5 4
2 2 4 1 1
3 5
5 4 5
4 4
4 4 4 4
3 10
7 8 9

----- Sample Output 1 ------ 
4
3
4
3
----- explanation 1 ------ 
Test case 1: In single-target mode, all enemies can be killed in $1$ second each. Thus, in single-target mode, the total time required is $5$ seconds.  
In multi-target mode:
- After one second, the health points of the enemies are: $[1, 1, 3, 0, 0]$. Enemies $4$ and $5$ are dead after one second.
- After two seconds, the health points of the enemies are: $[0, 0, 2, 0, 0]$.
- After three seconds, the health points of the enemies are: $[0, 0, 1, 0, 0]$.
- After four seconds, the health points of the enemies are: $[0, 0, 0, 0, 0]$.

Thus, $4$ seconds are required to kill enemies using multi-target mode. The minimum time required to kill all the enemies is $4$ seconds.

Test case 2: In single-target mode, all enemies can be killed in $1$ second each. Thus, in single-target mode, the total time required is $3$ seconds.  
In multi-target mode:
- After one second, the health points of the enemies are: $[4, 3, 4]$.
- After two seconds, the health points of the enemies are: $[3, 2, 3]$.
- After three seconds, the health points of the enemies are: $[2, 1, 2]$.
- After four seconds, the health points of the enemies are: $[1, 0, 1]$.
- After five seconds, the health points of the enemies are: $[0, 0, 0]$.

Thus, $5$ seconds are required to kill enemies using multi-target mode. The minimum time required to kill all the enemies is $3$ seconds.

Test case 3: Here, single-target mode will take $4$ seconds and multi-target mode will also take $4$ seconds. Therefore, the minimum time required is $4$ seconds.

Test case 4: Here, single-target mode will take $3$ seconds, while multi-target mode will take $9$ seconds. Therefore, the minimum time required is $3$ seconds.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
for _ in range(int(input())):
	(NumbEnemies, Damage) = list(map(int, input().split()))
	Health = list(map(int, input().split()))
	cnts = []
	cntShootsSingle = 0
	for shoot in Health:
		cntShootsSingle = cntShootsSingle + (shoot - 1) // Damage + 1
		cnts.append(cntShootsSingle)
	cntShootsMulti = Health[0]
	for i in range(0, len(Health)):
		if Health[i] >= cntShootsMulti:
			cntShootsMulti = Health[i]
			cnts.append(cntShootsMulti)
	print(min(cntShootsSingle, cntShootsMulti))


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	enemyhealth = sorted(list(map(int, input().split())))
	maxhealth = max(enemyhealth)
	if n >= maxhealth:
		print(maxhealth)
		continue
	else:
		cnt = 0
		for enemy in enemyhealth:
			cnt += -(-enemy // x)
		print(min(cnt, maxhealth))


import math
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	health = list(map(int, input().split()))
	multi_shot = max(health)
	single_shot = 0
	for i in range(n):
		single_shot += math.ceil(health[i] / x)
	print(min(multi_shot, single_shot))


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	if n > max(h):
		print(max(h))
	else:
		c = 0
		for i in h:
			c += -(-i // x)
		print(min(c, max(h)))


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	c = max(l)
	d = 0
	for i in l:
		if i <= k:
			d += 1
		else:
			d += math.ceil(i / k)
	print(min(d, c))


import math
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	val = 0
	for i in a:
		if i <= x:
			val += 1
		else:
			val += math.ceil(i / x)
	print(min(max(a), val))


for i in range(int(input())):
	(n, x) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	c1 = 0
	c = 0
	for j in l:
		while j > 0:
			j = j - x
			c1 = c1 + 1
	c = max(l)
	if c1 > c:
		print(c)
	elif c1 == c:
		print(c1)
	else:
		print(c1)


import math
for t in range(int(input())):
	(n, x) = map(int, input().split(' '))
	h = list(map(int, input().split(' ')))
	if max(h) <= n:
		print(max(h))
	else:
		time = 0
		for health in h:
			time += math.ceil(health / x)
		print(min(time, max(h)))


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	eh = sorted(list(map(int, input().split())))
	maxh = max(eh)
	if n >= maxh:
		print(maxh)
		continue
	else:
		cnt = 0
		for e in eh:
			cnt += -(-e // x)
		print(min(cnt, maxh))


t = int(input())
for tc in range(t):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	a = max(h)
	p = 0
	for j in range(n):
		if h[j] % x == 0:
			p += h[j] // x
		else:
			p += h[j] // x + 1
	print(min(p, a))


for i in range(int(input())):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	m = max(h)
	s = 0
	for i in range(n):
		if h[i] % x == 0:
			s += h[i] // x
		else:
			s += h[i] // x + 1
	print(min(m, s))


for _ in range(int(input())):
	(n, p) = map(int, input().split())
	l = list(map(int, input().split()))
	maxval = max(l)
	tone = 0
	tmul = 0
	flag = False
	tmul = maxval
	if maxval <= p:
		tone = n
	else:
		for i in range(n):
			while l[i] != 0:
				if l[i] >= p:
					l[i] -= p
					tone += 1
					if tone > tmul:
						flag = True
						break
				else:
					l[i] = 0
					tone += 1
					if tone > tmul:
						flag = True
						break
			if flag:
				break
	print(min(tone, tmul))


import math
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = [int(y) for y in input().split()]
	print(min([sum([math.ceil(i / x) for i in a]), max(a)]))


from math import ceil
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	mtm = max(l)
	c = 0
	for i in l:
		c = c + ceil(i / x)
	print(min(mtm, c))


for _ in range(int(input())):
	(n, a) = map(int, input().split())
	li = list(map(int, input().split()))
	c = 0
	for i in li:
		if i > a:
			c += i // a
			if i % a != 0:
				c += 1
		else:
			c += 1
	print(min(c, max(li)))


from math import ceil
T = int(input())
for _ in range(T):
	(n, x) = map(int, input().split())
	L = list(map(int, input().split()))
	s = 0
	c = max(L)
	for i in L:
		d = ceil(i / x)
		s += d
	if s <= c:
		print(s)
	else:
		print(c)


import math
for i in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 0
	for val in l:
		count += math.ceil(val / x)
	print(min(count, max(l)))


import math
t = int(input())
while t:
	t -= 1
	(n, x) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	c = 0
	p = max(a)
	for i in a:
		c = c + math.ceil(i / x)
	print(min(c, p))


import math

def inf(h, x):
	d = max(h)
	c = 0
	for i in h:
		c += math.ceil(i / x)
	return min(c, d)
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	print(inf(h, x))


from math import ceil
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	h = list(map(int, input().strip().split()))[:n]
	c1 = 0
	c2 = max(h)
	for i in h:
		d = ceil(i / x)
		c1 += d
	if c1 <= c2:
		print(c1)
	else:
		print(c2)


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

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

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

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

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

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

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	(n, x) = mp()
	l = li()
	ans = max(l)
	a = 0
	for i in l:
		a += (i + x - 1) // x
	pr(min(ans, a))
for _ in range(inp()):
	solve()


import math
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	eni = list(map(int, input().split()))
	maxi = max(eni)
	s = sum((math.ceil(i / y) for i in eni))
	print(min(maxi, s))


import math
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = max(a)
	c = 0
	for y in a:
		c += math.ceil(y / x)
	z = min(b, c)
	print(z)


for _ in range(int(input())):
	(N, X) = map(int, input().split())
	H = list(map(int, input().split()))
	hmx = max(H)
	ta = hmx
	tim = lambda x: x // X + (x % X > 0)
	t1 = sum(map(tim, H))
	print(min(ta, t1))


import math
T = int(input())
for i in range(1, T + 1):
	(N, X) = map(int, input().split())
	H = [int(i) for i in input().split()]
	c = 0
	for i in range(N):
		c += max(1, math.ceil(H[i] / X))
	j = max(H)
	print(min(j, c))


def main():
	t = int(input())
	while t:
		(n, x) = map(int, input().split())
		arr = list(map(int, input().split()))[:n]
		mn = 0
		s1 = 0
		for i in range(n):
			if arr[i] % x == 0:
				s1 += arr[i] // x
			else:
				s1 += arr[i] // x + 1
			mn = max(mn, arr[i])
		print(min(s1, mn))
		t -= 1
main()


import math
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	m = max(h)
	o = 0
	for i in h:
		o += math.ceil(i / x)
	print(min(m, o))


from math import ceil
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = [int(i) for i in input().split()]
	c = 0
	for i in range(n):
		c += max(1, ceil(a[i] / x))
	j = max(a)
	print(min(j, c))


from math import ceil
t = int(input())
while t > 0:
	(n, x) = map(int, input().split(' '))
	h = list(map(int, input().split(' ')))
	c = 0
	for i in range(n):
		c = c + max(1, ceil(h[i] / x))
	j = max(h)
	print(min(j, c))
	t = t - 1


import sys
for _ in range(int(sys.stdin.readline())):
	(n, x) = map(int, sys.stdin.readline().split())
	h = list(map(int, sys.stdin.readline().split()))
	s = 0
	for i in h:
		s += (i + x - 1) // x
	sys.stdout.write(str(min(s, max(h))) + '\n')


_ = int(input())
for __ in range(0, _):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 0
	cm = max(a)
	for i in range(0, n):
		while a[i] > 0:
			a[i] = a[i] - x
			c += 1
	if c > cm:
		print(cm)
	else:
		print(c)


t = int(input())
while t > 0:
	(n, x) = input().split(' ')
	(n, x) = (int(n), int(x))
	h = [eval(i) for i in input().split(' ')]
	sin = max(h)
	mul = 0
	for i in h:
		while i > 0:
			mul += 1
			i -= x
	print(min(sin, mul))
	t -= 1


for i in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	c = 0
	for i in l:
		if i <= x:
			c += 1
		elif i % x == 0:
			c = c + i // x
		else:
			c = c + i // x + 1
	print(min(c, max(l)))


for _ in range(int(input())):
	(N, X) = map(int, input().split())
	A = list(map(int, input().split()))
	multi = max(A)
	single = 0
	for i in A:
		if i <= X:
			single += 1
		else:
			while i > X:
				i -= X
				single += 1
			single += 1
	print(min(multi, single))


import math
for _ in range(int(input())):
	(N, X) = map(int, input().split())
	H = list(map(int, input().split()))
	t0 = sum((math.ceil(x / X) for x in H))
	t1 = max(H)
	print(min(t0, t1))


for i in range(int(input())):
	(n, x) = list(map(int, input().split()))
	h = list(map(int, input().split()))
	(m, s) = (max(h), 0)
	while sum(h) != 0 and s < m:
		for j in range(n):
			if s < m and set(h) != 0 and (h[j] != 0):
				if h[j] < x:
					h[j] = 0
					s += 1
				elif h[j] >= x:
					h[j] = h[j] - x
					s += 1
	if s < m:
		print(s)
	else:
		print(m)


t = int(input())
while t != 0:
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	s = 0
	for k in l:
		if k % x == 0:
			s += k // x
		else:
			s += k // x + 1
	m = max(l)
	print(min(m, s))
	t -= 1


from math import ceil
for tc in range(int(input())):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	(si, mu) = (0, 0)
	for i in h:
		si += ceil(i / x)
	mu = max(h)
	print(min(si, mu))


from math import ceil
t = int(input())
for ni in range(t):
	(n, x) = map(int, input().split())
	a = [int(i) for i in input().split()]
	nmult = max(a)
	nsing = 0
	for i in a:
		nsing = nsing + ceil(i / x)
	print(min(nmult, nsing))


T = int(input())
while T != 0:
	T -= 1
	(N, X) = [int(x) for x in input().split()]
	H = [int(x) for x in input().split()]
	time = 0
	high = max(H)
	for i in range(len(H)):
		if H[i] <= X:
			time = time + 1
		else:
			while H[i] > 0:
				H[i] = H[i] - X
				time = time + 1
	if time >= high:
		print(high)
	else:
		print(time)


for _ in range(int(input())):
	(n, std) = map(int, input().split())
	hp = list(map(int, input().split()))
	stm = []
	count = 0
	for i in hp:
		if i % std == 0:
			stm.append(i // std)
		else:
			stm.append(i // std + 1)
	print(min(sum(stm), max(hp)))


import math
for t in range(int(input())):
	(n, x) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	c = max(l)
	s = 0
	if n < c:
		for i in l:
			s += math.ceil(i / x)
	if s != 0 and s < c:
		print(s)
	else:
		print(c)


import math
for i in range(int(input())):
	(nEnemy, damage) = map(int, input().split())
	lis = list(map(int, input().split()))
	t0 = sum((math.ceil(x / damage) for x in lis))
	t1 = max(lis)
	print(min(t0, t1))


import math
t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	ss = sum((math.ceil(k / x) for k in arr))
	ms = max(arr)
	print(min(ss, ms))


import math
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	(s1, m1) = (0, 0)
	for i in h:
		s1 += math.ceil(i / x)
	m1 = max(h)
	if s1 <= m1:
		print(s1)
	else:
		print(m1)


t = int(input())
for dummy in range(t):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	h.sort()
	min_mul = h[-1]
	min_sin = 0
	for e in h:
		min_sin += e // x
		if e % x > 0:
			min_sin += 1
	print(min(min_mul, min_sin))


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	ans = 0
	for i in h:
		if i % x == 0:
			ans += i // x
		else:
			ans += i // x + 1
	print(min(ans, max(h)))


for i in range(int(input())):
	(n, x) = map(int, input().split())
	li = list(map(int, input().split()))
	gre = []
	double = max(li)
	single = count = rem = sec = 0
	for j in li:
		if j > x:
			count += 1
	if count == 0:
		if double <= len(li):
			print(double)
		else:
			print(len(li))
	else:
		for k in li:
			if k > x:
				gre.append(k)
		for m in gre:
			while m > x:
				m = m - x
				sec += 1
			if m == 0:
				sec = sec
			else:
				sec += 1
		rem = abs(len(li) - len(gre))
		single = rem + sec
		if double <= single:
			print(double)
		else:
			print(single)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = 0
	for j in l:
		if j % x == 0:
			ans += j // x
		else:
			ans += j // x + 1
	print(min(ans, max(l)))


T = int(input())
import math
for _ in range(T):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	multi_target_time = max(A)
	single_target_time = 0
	for i in A:
		if i <= x:
			single_target_time += 1
		else:
			single_target_time += math.ceil(i / x)
	print(min(multi_target_time, single_target_time))


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	m = max(h)
	h.sort()
	count = 0
	for i in range(n):
		temp = h[i] % x
		res = h[i] // x
		if temp == 0:
			count = count + res
		else:
			count = count + (res + 1)
	if m < count:
		print(m)
	else:
		print(count)


for k in range(int(input())):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	ma = max(h)
	i = 0
	count = 0
	while i < n:
		if h[i] > x:
			h[i] -= x
			count += 1
		else:
			h[i] = 0
			count += 1
			i += 1
	if ma < count:
		print(ma)
	else:
		print(count)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	h = list(map(int, input().split()))
	p = max(h)
	u = 0
	j = 0
	while j < n:
		if h[j] > x and h[j] % x > 0:
			q = h[j] // x + 1
			u += q
		elif h[j] > x and h[j] % x == 0:
			q = h[j] // x
			u += q
		else:
			u += 1
		j += 1
	if p <= u:
		print(p)
	else:
		print(u)


import math
for _ in range(int(input())):
	(N, W) = map(float, input().split())
	H = list(map(float, input().split()))
	H.sort(reverse=True)
	x1 = H[0]
	H2 = [math.ceil(x / W) for x in H]
	x2 = sum(H2)
	if x1 > x2:
		print(int(x2))
	else:
		print(int(x1))


from math import *
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	li = list(map(int, input().split()))
	li.sort()
	m2 = li[n - 1]
	m1 = 0
	for j in range(n):
		while li[j] > 0:
			m1 = m1 + 1
			li[j] = li[j] - x
	print(str(min(m2, m1)))


for _ in range(int(input())):
	(N, X) = input().split()
	(N, X) = (int(N), int(X))
	li = list(map(int, input().split()))
	maxm = max(li)
	count = 0
	for i in range(len(li)):
		while li[i] > 0:
			count += 1
			li[i] -= X
	print(min(count, maxm))


import math
t = int(input())
while t > 0:
	(n, x) = list(map(int, input().split()))
	list1 = list(map(int, input().split()))
	if max(list1) <= n:
		if max(list1) >= len(list1):
			print(len(list1))
		else:
			print(max(list1))
	else:
		listc = list(map(lambda z: math.ceil(z / x), list1))
		if sum(listc) < max(list1):
			print(sum(listc))
		else:
			print(max(list1))
	t = t - 1


for _ in range(int(input())):
	(N, X) = [int(x) for x in input().split()]
	L = list(map(int, input().split()))
	count = 0
	for i in range(len(L)):
		count = count + int(L[i] / X)
		if L[i] % X > 0:
			count = count + 1
	L.sort()
	count1 = L[len(L) - 1]
	if count1 > count:
		print(count)
	else:
		print(count1)


for _ in range(int(input())):
	(n, x) = input().split()
	(n, x) = (int(n), int(x))
	l = list(map(int, input().split()))
	r = max(l)
	cnt = 0
	for i in range(n):
		while l[i] > 0:
			l[i] -= x
			cnt += 1
	if cnt > r:
		print(r)
	else:
		print(cnt)


for _ in range(int(input())):
	(n, x) = input().split()
	(n, x) = (int(n), int(x))
	h = list(map(int, input().split()))
	r = max(h)
	c = 0
	for i in range(n):
		while h[i] > 0:
			h[i] = h[i] - x
			c += 1
	f = min(c, r)
	print(f)


from math import ceil
o = int(input())
for i in range(o):
	(l, m) = map(int, input().split())
	a = list(map(int, input().split()))
	e = max(a)
	f = 0
	for j in a:
		f += ceil(j / m)
	print(min(f, e))


from math import ceil
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	one = max(arr)
	two = 0
	for i in arr:
		two += ceil(i / x)
	print(min(two, one))


from math import ceil
for _ in range(int(input())):
	(N, X) = map(int, input().split())
	H = list(map(int, input().split()))
	count = 0
	for value in H:
		count = count + ceil(value / X)
	print(min(max(H), count))