Read problems statements in [Mandarin Chinese], [Russian], [Vietnamese] and [Bengali] as well.

Suppose the population is divided into the age groups $[1, 10], [11, 20], [21, 30], \ldots, [91, \infty)$. The age groups are numbered from $1$ to $10$ and there are $X_{i}$ people in age group $i$.

The COVID vaccine drive has started and people will be vaccinated in the decreasing order of their age groups. Suppose $P$ people are vaccinated per day and if less than $P$ people are left in an age group, then the remaining doses for that day are given to the people of immediate lower age group and the process for that day continues until the vaccines for that day are finished or the entire population has been vaccinated. The selection of a person from a given age group is done randomly.

Given $X$, $P$, and Chef’s age group $G$, tell the minimum and the maximum number of days will it take for Chef to get vaccinated.

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

The first line contains an integer $T$, the number of test cases. Then the test cases follow. 
Each test case contains a single line of input, twelve integers $G$, $P$, $X_{1}, X_{2}, \ldots, X_{10}$. 

------ Output ------
For each test case, output in a single line two space-separated integers, the minimum and maximum time required for Chef to get vaccinated.

------ Constraints  ------
$1 ≤ T ≤ 10^{4}$
$1 ≤ G ≤ 10$
$1 ≤ P, X_{i} ≤ 10^{5}$

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

5 2 2 2 2 2 2 2 2 2 2 2

5 2 2 2 2 2 2 3 2 2 2 2

9 4 2 2 2 2 3 2 2 2 2 2
----- Sample Output 1 ------ 
6 6

6 7

1 1
----- explanation 1 ------ 
Test Case $1$: It takes one day for every age group to get vaccinated.

Test Case $2$: Age groups $10 - 7$ get vaccinated in a total of $4$ days. On the $5$-th day, $2$ out of $3$ people of age group $6$ get vaccinated. On the $6$-th day, the last person of the $6$-th age group and one random person of the $5$-th age group gets vaccinated. So if the person is Chef, the minimum time required for him to get vaccinated will be $6$ days, and if not, Chef will get vaccinated on the $7$-th day.

Test Case $3$: The last $2$ age groups get vaccinated on the same day.

Source: codechef | Difficulty: MEDIUM_HARD
Tags: Constructive algorithms

Mathematics

Ad-hoc


Solutions:
for _ in range(int(input())):
	l = list(map(int, input().split()))
	g = l[0]
	g -= 1
	p = l[1]
	l = l[2:]
	s = sum(l[g:])
	s -= l[g]
	mini = s // p + 1
	maxi = l[g] + s % p
	if maxi % p == 0:
		print(mini, mini + maxi // p - 1)
	else:
		print(mini, mini + maxi // p)


for _ in range(int(input())):
	N = list(map(int, input().split()))
	G = N[0]
	P = N[1]
	Y = sum(N[G + 1:])
	if G == 10:
		X = 1
	else:
		X = sum(N[G + 2:]) + 1
	print(-(-X // P), -(-Y // P))


import math
t = int(input())
for _ in range(t):
	i = list(map(int, input().split()))
	g = i[0]
	p = i[1]
	x = i[2:]
	gp = sum(x[g:])
	gmin = gp + 1
	gmax = gp + x[g - 1]
	print(math.ceil(gmin / p), math.ceil(gmax / p))


def lisin():
	a = list(map(int, input().split()))
	return a
for tastcas in range(int(input())):
	a = lisin()
	g = a.pop(0)
	p = a.pop(0)
	bef = 0
	for i in range(9, g - 1, -1):
		bef += a[i]
	d = bef // p
	mi = d + 1
	t = bef + a[g - 1]
	ma = t // p
	if t > ma * p:
		ma += 1
	print(mi, ma)


t = int(input())
while t:
	x = list(map(int, input().split()))
	g = x[0]
	p = x[1]
	x.pop(0)
	x.pop(0)
	su = 0
	for i in range(len(x) - 1, g - 1, -1):
		su += x[i]
	day = su // p
	min_day = day + 1
	su += x[g - 1]
	if su % p == 0:
		max_day = su // p
	else:
		max_day = su // p + 1
	print(min_day, max_day)
	t -= 1


from collections import Counter
from math import ceil, floor, log, gcd
import bisect as bs
import sys
input = sys.stdin.readline
inp_lis = lambda : list(map(int, input().split()))
inp_multi = lambda : map(int, input().split())
inp_int = lambda : int(input().strip())
for _ in range(int(input().strip())):
	(g, p, *l) = list(map(int, input().strip().split()))
	n = len(l)
	l = l[::-1]
	s = 0
	last = n - g
	i = 0
	for i in range(last):
		s += l[i]
	(mini, maxi) = (0, 0)
	mini = ceil((s + 1) / p)
	s += l[last]
	maxi = int(ceil(s / p))
	print(mini, maxi, sep=' ')


for _ in range(int(input())):
	(g, p, *x) = list(map(int, input().strip().split()))
	n = len(x)
	x = x[::-1]
	mn = 0
	i = -1
	for i in range(n - g):
		mn += x[i]
	mx = mn + (x[i + 1] - 1)
	a = mn // p
	b = mx // p
	print(a + 1, b + 1)


from sys import stdin, stdout
input = stdin.readline
t = int(input().strip())
for _ in range(t):
	(g, p, *x) = list(map(int, input().strip().split()))
	n = len(x)
	x = x[::-1]
	mini = 0
	i = -1
	for i in range(n - g):
		mini += x[i]
	maxi = mini + (x[i + 1] - 1)
	a = mini // p
	b = maxi // p
	print(a + 1, b + 1)


from math import ceil
for _ in range(int(input())):
	input_arr = list(map(int, input().strip().split(' ')))
	G = input_arr[0]
	P = input_arr[1]
	X = input_arr[G + 1:]
	vaccination_group = X[0]
	total_to_vaccinate = sum(X)
	min_to_vaccinate = sum(X[1:])
	min_days = ceil((min_to_vaccinate + 1) / P)
	max_days = ceil(total_to_vaccinate / P)
	print(min_days, max_days)


import math
try:
	t = int(input())
	for i in range(t):
		arr = list(map(int, input().split()))
		sum = 0
		for x in range(-1, arr[0] - 11, -1):
			sum += arr[x]
		if sum % arr[1] == 0:
			minimum = sum // arr[1] + 1
		else:
			minimum = math.ceil(sum / arr[1])
		maximum = math.ceil((sum + arr[arr[0] - 11]) / arr[1])
		print(minimum, maximum)
except:
	pass


from math import *
import sys

def input():
	return sys.stdin.readline().replace('\n', '').strip()
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	(g, p, *l) = list(map(int, input().split()))
	cur = l[g - 1]
	s = sum(l[g:])
	_min = ceil((s + 1) / p)
	_max = ceil((s + cur) / p)
	print(_min, _max)


import math
p = int(input())
for i in range(p):
	l = list(map(int, input().split()))
	q = 0
	e = l[0]
	g = l[1]
	for i in range(e + 2, 12):
		q += l[i]
	x = l[e + 1] + q % g
	ans = q // g
	y = ans + 1
	m = ans + math.ceil(x / g)
	print(y, end=' ')
	print(m)


import math
t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	c = 0
	a = l[0]
	b = l[1]
	for i in range(a + 2, 12):
		c += l[i]
	x = l[a + 1] + c % b
	ans = c // b
	y = ans + 1
	m = ans + math.ceil(x / b)
	print(y, end=' ')
	print(m)


for _ in range(int(input())):
	(g, p, *a) = list(map(int, input().split()))
	if g == 10:
		b = a[-1] % p
		if b == 0:
			print(1, a[-1] // p)
		else:
			print(1, a[-1] // p + 1)
	else:
		c = sum(a[g - 1:]) % p
		b = sum(a[g:]) // p + 1
		if c == 0:
			c = sum(a[g - 1:]) // p
		else:
			c = sum(a[g - 1:]) // p + 1
		print(b, c)


def requ(l, d):
	if (l / d).is_integer():
		return int(l / d)
	else:
		return int(l / d) + 1
for _ in range(int(input())):
	data = list(map(int, input().split()))
	dose = data[1]
	chef = data[0] + 1
	vacinated = sum(data[chef + 1:])
	up_flat = vacinated / dose
	if up_flat.is_integer():
		up_flat = int(up_flat)
		if data[chef] <= dose:
			up_flat += 1
			print(up_flat, up_flat)
		else:
			req = requ(data[chef], dose)
			print(up_flat + 1, up_flat + req)
	else:
		up_flat = int(up_flat) + 1
		extra = dose * up_flat - vacinated
		if extra >= data[chef]:
			print(up_flat, up_flat)
		else:
			req = requ(data[chef] - extra, dose)
			print(up_flat, up_flat + req)


import math
t = int(input())
for _ in range(t):
	x = 0
	li = list(map(int, input().split()))
	g = li[0]
	p = li[1]
	for i in range(g + 2, 12):
		x += li[i]
	val1 = li[g + 1] + x % p
	ans = x // p
	mn = ans + 1
	mx = ans + math.ceil(val1 / p)
	print(mn, end=' ')
	print(mx)


for _ in range(int(input())):
	(g, p, *x) = map(int, input().split())
	x = list(x)
	(a, b) = (sum(x[-1:g - 11:-1]) + 1, sum(x[-1:g - 12:-1]))

	def ceil(x, p):
		if x % p == 0:
			return x // p
		else:
			return x // p + 1
	print(ceil(a, p), ceil(b, p))


from math import ceil
for t in range(int(input())):
	l = list(map(int, input().split()))
	(g, p) = (l[0], l[1])
	l = l[2:]
	sum = 0
	for i in range(len(l) - 1, g - 1, -1):
		sum += l[i]
	min_day = ceil((sum + 1) / p)
	max_day = ceil((sum + l[g - 1]) / p)
	print(min_day, max_day)


for i in range(int(input())):
	arr = list(map(int, input().split()))
	g = arr[0]
	d = arr[1]
	count = 0
	s = sum(arr[g + 2:len(arr)])
	r = s % d
	c = s // d
	print(c + 1, end=' ')
	s = r + arr[arr[0] + 1]
	r = s % d
	c1 = s // d
	if r != 0:
		print(c1 + c + 1)
	else:
		print(c1 + c)


T = int(input())
for _ in range(T):
	l = []
	(G, P, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) = input().split()
	G = int(G)
	P = int(P)
	X1 = int(X1)
	X2 = int(X2)
	X3 = int(X3)
	X4 = int(X4)
	X5 = int(X5)
	X6 = int(X6)
	X7 = int(X7)
	X8 = int(X8)
	X9 = int(X9)
	X10 = int(X10)
	l.append(X1)
	l.append(X2)
	l.append(X3)
	l.append(X4)
	l.append(X5)
	l.append(X6)
	l.append(X7)
	l.append(X8)
	l.append(X9)
	l.append(X10)
	a = 0
	b = 0
	for j in range(G, 10):
		a += l[j]
	Min = a // P
	Min += 1
	for k in range(G - 1, 10):
		b += l[k]
	Max = b // P
	if b % P == 0:
		pass
	else:
		Max += 1
	print(Min, Max)


import math
t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	l.append(0)
	g = l[0]
	p = l[1]
	min = 1
	max = 0
	for i in range(g + 2, len(l)):
		min += l[i]
	for j in range(g + 1, len(l)):
		max += l[j]
	print(math.ceil(min / p), math.ceil(max / p))


import math
for i in range(int(input())):
	l = [int(x) for x in input().split()]
	(g, p) = (l[0], l[1])
	s = sum(l[g + 2:12]) // p
	j = math.ceil((sum(l[g + 2:12]) % p + l[g + 1]) / p) + s
	print(s + 1, j)


from math import ceil
for i in range(int(input())):
	nums = [int(x) for x in input().split()]
	g = nums[0]
	p = nums[1]
	nums = nums[2:]
	nums = nums[g - 1:]
	summation = sum(nums)
	ans = ceil((summation - nums[0] + 1) / p)
	print(ans, ceil(summation / p))


import math
for _ in range(int(input())):
	x = list(map(int, input().split()))
	(g, p) = (x[0], x[1])
	x = x[2:]
	sm = sum(x[g:])
	sn = sum(x[g - 1:])
	mx = [0, math.ceil(sn / p)]
	(q, r) = divmod(sm, p)
	mx[0] = q + 1
	print(*mx)


import math
for _ in range(int(input())):
	temp = 0
	arr = list(map(int, input().split()))
	(g, p) = (arr[0], arr[1])
	for i in range(g + 2, 12):
		temp += arr[i]
	ans = temp // p
	sum = arr[g + 1] + temp % p
	print(ans + 1, end=' ')
	print(ans + math.ceil(sum / p))


import math
for _ in range(int(input())):
	l = list(map(int, input().split()))
	g = l[0]
	p = l[1]
	persons = 0
	for i in range(g + 2, 12):
		persons += l[i]
	total = persons % p + l[g + 1]
	min_val = persons // p
	print(min_val + 1, end=' ')
	max_val = min_val + math.ceil(total / p)
	print(max_val)


import math
t = int(input())
for i in range(t):
	line1 = input().split(' ')
	G = int(line1[0])
	p = int(line1[1])
	sum = 0
	arr = []
	sum = sum + int(line1[2])
	arr.append(sum)
	sum = sum + int(line1[3])
	arr.append(sum)
	sum = sum + int(line1[4])
	arr.append(sum)
	sum = sum + int(line1[5])
	arr.append(sum)
	sum = sum + int(line1[6])
	arr.append(sum)
	sum = sum + int(line1[7])
	arr.append(sum)
	sum = sum + int(line1[8])
	arr.append(sum)
	sum = sum + int(line1[9])
	arr.append(sum)
	sum = sum + int(line1[10])
	arr.append(sum)
	sum = sum + int(line1[11])
	arr.append(sum)
	total = arr[9]
	useful = total - arr[G - 1]
	min = math.ceil((useful + 1) / p)
	max = math.ceil((useful + int(line1[G + 1])) / p)
	print(min, max)


n = int(input())
for _ in range(n):
	lyst = list(map(int, input().split(' ')))
	(g, p, c) = (lyst[0], lyst[1], 0)
	lyst = lyst[2:]
	for i in range(g - 1, 10):
		c += lyst[i]
	k = lyst[g - 1]
	a = c - k
	m = a // p + 1
	l = a % p + k
	n = l // p
	if l % p != 0:
		n += 1
	print(m, n + m - 1)


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	(x, y) = (a[0], a[1])
	b = a[x + 1:]
	print(sum(b[1:]) // y + 1, end=' ')
	k = sum(b)
	if k % y == 0:
		print(k // y)
	else:
		print(k // y + 1)


import math
for _ in range(int(input())):
	l = list(map(int, input().split()))
	g = l[0]
	p = l[1]
	l = l[2:]
	s = 0
	for i in range(9, g - 1, -1):
		s += l[i]
	c = l[g - 1]
	print(math.ceil((s + 1) / p), math.ceil((s + c) / p))


import math
for _ in range(int(input())):
	dem = 0
	arr = list(map(int, input().split()))
	(A, P) = (arr[0], arr[1])
	for i in range(A + 2, 12):
		dem += arr[i]
	ans = dem // P
	sum = arr[A + 1] + dem % P
	print(ans + 1, end=' ')
	print(ans + math.ceil(sum / P))


import math
for i in range(int(input())):
	arr = list(map(int, input().split()))
	(g, p) = (arr[0], arr[1])
	loc = g + 2
	(s, mind, maxd) = (0, 0, 0)
	for j in range(loc, len(arr)):
		s += arr[j]
	mind = math.ceil((s + 1) / p)
	maxd = math.ceil((s + arr[g + 1]) / p)
	print(mind, maxd)


import math
for i in range(int(input())):
	l = [int(i) for i in input().split()][:12]
	g = l[0]
	p = l[1]
	o = 0
	for i in range(g + 2, 12):
		o += l[i]
	total = o % p + l[g + 1]
	ans = o // p
	print(ans + 1, end=' ')
	ansmax = ans + math.ceil(total / p)
	print(ansmax)


import math
for _ in range(int(input())):
	l = list(map(int, input().split()))
	g = l[0]
	p = l[1]
	oldpeople = 0
	for i in range(g + 2, 12):
		oldpeople += l[i]
	total = oldpeople % p + l[g + 1]
	ans = oldpeople // p
	print(ans + 1, end=' ')
	ansmax = ans + math.ceil(total / p)
	print(ansmax)


import math
for _ in range(int(input())):
	megaa = list(map(int, input().split()))
	(g, p, x) = (megaa[0], megaa[1], megaa[2:])
	b4_chef_total = sum(x[g:])
	cheff_tt = b4_chef_total + 1
	maxx_cheff = b4_chef_total + x[g - 1]
	print(math.ceil(cheff_tt / p), math.ceil(maxx_cheff / p))


import math
t = int(input())
while t > 0:
	t -= 1
	lst = list(map(int, input().split()))
	X = lst[0]
	P = lst[1]
	lst = lst[2:]
	sum = 0
	for i in range(X, 10):
		sum += lst[i]
	min = sum // P
	sum = sum % P
	while sum >= P:
		min += 1
		sum -= P
	sum += lst[X - 1]
	max = min + math.ceil(sum / P)
	print(min + 1, max)


import math
from math import ceil
for _ in range(int(input())):
	l = list(map(int, input().split()))
	g = l[0]
	p = l[1]
	x = l[2:12]
	chef_group = l[g + 1]
	before_chef = sum(l[g + 2:12])
	case_a = before_chef + 1
	case_b = before_chef + chef_group
	min_days = ceil(case_a / p)
	max_days = ceil(case_b / p)
	print(min_days, max_days)


from math import ceil
for t in range(int(input())):
	given = list(map(int, input().split()))
	chef = given[0]
	p = given[1]
	chef_group_people = given[chef + 1]
	before_chef = sum(given[chef + 2:12])
	case_1 = before_chef + 1
	case_2 = before_chef + chef_group_people
	min_days = ceil(case_1 / p)
	max_days = ceil(case_2 / p)
	print(min_days, max_days)


import math
t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	g = arr[0]
	p = arr[1]
	diff = 0
	for i in range(g + 2, 12):
		diff += arr[i]
	x = diff // p
	Sum = arr[g + 1] + diff % p
	print(x + 1, end=' ')
	print(x + math.ceil(Sum / p))


import math

def read():
	return list(map(int, input().split()))
t = read()[0]
for i in range(t):
	x = read()
	g = x[0]
	p = x[1]
	x = x[2:]
	y = x[g:]
	sumy = 0
	for i in y:
		sumy += i
	min = math.ceil((sumy + 1) / p)
	max = math.ceil((sumy + x[g - 1]) / p)
	print(min, max)


import math
t = int(input())
for _ in range(t):
	age_groups_list = ['#']
	age_groups_list.extend(list(map(int, input().split())))
	G = age_groups_list.pop(1)
	P = age_groups_list.pop(1)
	total_persons = sum(age_groups_list[G + 1:])
	min_days = math.ceil((total_persons + 1) / P)
	max_days = math.ceil((total_persons + age_groups_list[G]) / P)
	print(min_days, max_days)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	l = list(map(int, sys.stdin.readline().split()))
	(g, p) = l[:2]
	x = l[2:]
	s = sum(x[g:])
	d = s // p
	minimum = d + 1
	s = s + x[g - 1]
	d2 = s // p
	r = s % p
	if r == 0:
		maximum = d2
	else:
		maximum = d2 + 1
	print(minimum, maximum)


t = int(input())
while t:
	z = list(map(int, input().split()))
	(g, p) = (z[0], z[1])
	l = z[g + 1:]
	print(sum(l[1:]) // p + 1, end=' ')
	k = sum(l)
	if k % p == 0:
		print(k // p)
	else:
		print(k // p + 1)
	t -= 1


T = int(input())
for i in range(T):
	a = [int(s) for s in input().split()]
	(age_grp, cap) = (a[0], a[1])
	sum_1 = sum(a[age_grp + 2:])
	sum_2 = sum(a[age_grp + 1:])
	mini = sum_1 // cap + 1
	maxi = sum_2 // cap
	if maxi * cap != sum_2:
		maxi += 1
	print(mini, maxi)


t = int(input())
while t > 0:
	t -= 1
	arr = list(map(int, input().split()))
	j = arr[0] + 1
	i = 11
	sum1 = 0
	while i > j:
		sum1 = sum1 + arr[i]
		i -= 1
	p = arr[1]
	print((sum1 + p) // p, (sum1 + p - 1 + arr[i]) // p)


from math import ceil
for _ in range(int(input())):
	arr = list(map(int, input().split()))
	g = arr.pop(0)
	p = arr.pop(0)
	older = sum(arr[g:])
	min_days = int(ceil((older + 1) / p))
	max_days = int(ceil((older + arr[g - 1]) / p))
	print(min_days, max_days)


import math
n = int(input())
mainlist = []
for i in range(n):
	arr = [int(i) for i in input().strip().split()]
	Days = []
	G = arr[0]
	P = arr[1]
	ageGrp = arr[2:]
	ageOlder = sum(ageGrp[G:])
	minDays = int(math.ceil((ageOlder + 1) / P))
	maxDays = int(math.ceil((ageOlder + ageGrp[G - 1]) / P))
	print(minDays, maxDays)


for _ in range(int(input())):
	s = list(map(int, input().split()))
	(g, p, l) = (s[0], s[1], list(s[2:]))
	s = sum(l[g:])
	a = s // p
	print(a + 1, end=' ')
	s1 = a * p
	s1 += p
	s += l[g - 1]
	print(a + 1 + (s - s1 + p - 1) // p)


import math
for _ in range(int(input())):
	x = list(map(int, input().split()))
	s1 = sum([x[i] for i in range(x[0] + 2, 12)])
	print(s1 // x[1] + 1, s1 // x[1] + math.ceil((x[x[0] + 1] + s1 % x[1]) / x[1]), sep=' ')


import math
t = int(input())
while t:
	raw = list(map(int, input().split()))
	g = raw[0]
	p = raw[1]
	x = raw[2:]
	x.insert(0, 0)
	total = 0
	for i in range(g + 1, len(x)):
		total += x[i]
	days = total // p
	remaining = total % p
	min_days = days + 1
	x[g] += remaining
	max_days = math.ceil(x[g] / p) + days
	print('{} {}'.format(min_days, max_days))
	t -= 1


import math
for t in range(int(input())):
	lst = list(map(int, input().split()))
	g = lst.pop(0)
	p = lst.pop(0)
	mintotal = sum(lst[g:])
	mintm = mintotal // p + 1
	maxtm = math.ceil(sum(lst[g - 1:]) / p)
	print(mintm, maxtm)


import math
t = int(input())
while t > 0:
	t = t - 1
	dem = 0
	arr = list(map(int, input().split()))
	(G, P) = (arr[0], arr[1])
	for i in range(G + 2, 12):
		dem += arr[i]
	ans = dem // P
	sum = arr[G + 1] + dem % P
	print(ans + 1, end=' ')
	print(ans + math.ceil(sum / P))


import math
for _ in range(int(input())):
	l = [int(i) for i in input().split()]
	(g, p) = (l[0], l[1])
	l = l[2:].copy()
	days = sum(l[g:]) // p
	rem = sum(l[g:]) % p
	temp = l[g - 1] + rem
	print(days + 1, days + math.ceil(temp / p))


import math
for _ in range(int(input())):
	l = list(map(int, input().split()))
	(g, p) = (l[0], l[1])
	l1 = l[2:]
	min_day = sum(l1[g:]) // p + 1
	max_day = math.ceil(sum(l1[g - 1:]) / p)
	print(min_day, int(max_day))


T = int(input())
for i in range(T):
	days = 0
	min_days = 0
	max_days = 0
	vaccines_left = 0
	sum = 0
	li = list(map(int, input().split()))
	for j in range(11, li[0] + 1, -1):
		sum += li[j]
	days += sum // li[1]
	min_days = days + 1
	total_vaccines = min_days * li[1]
	vaccines_left = total_vaccines - sum
	peeps = li[li[0] + 1]
	if peeps <= vaccines_left:
		max_days = min_days
	else:
		peeps -= vaccines_left
		if peeps % li[1] == 0:
			max_days = min_days + peeps // li[1]
		else:
			max_days = min_days + peeps // li[1] + 1
	print(min_days, max_days)


import math
for _ in range(int(input())):
	lis = list(map(int, input().split()))
	lis = lis + [0] * 3
	G = lis.pop(0)
	P = lis.pop(0)
	v = sum(lis[G:10])
	mi = v // P
	ab = lis[G] + v % P
	r = P - v % P
	h = lis[G - 1] - r
	f = h // P
	if h % P == 0:
		ma = mi + f + 1
	else:
		ma = f + mi + 2
	print(mi + 1, ma)


import sys
MOD = 1000000007
inp = sys.stdin.readline

def ii():
	return int(inp())

def iis():
	return [int(i) for i in inp().split()]
t = ii()
for _ in range(t):
	(g, p, *x) = iis()
	total_ppl_to_vac_till_g = sum(x[g:])
	people_min = total_ppl_to_vac_till_g + 1
	days_min = people_min // p
	if people_min % p != 0:
		days_min += 1
	people_max = total_ppl_to_vac_till_g + x[g - 1]
	days_max = people_max // p
	if people_max % p != 0:
		days_max += 1
	print(days_min, days_max)


for i in range(int(input())):
	arr = [int(x) for x in input().split()]
	g = arr[0]
	p = arr[1]
	x = arr[2:]
	s = x[g:]
	s = sum(s)
	ans = 0
	mi = s // p + 1
	r = p - s % p
	a = x[g - 1] - r
	ma = a // p
	if a % p == 0:
		print(mi, ma + mi)
	else:
		print(mi, ma + mi + 1)


import math
t = int(input())
while t > 0:
	inp = [int(i) for i in input().split(' ')]
	g = inp.pop(0)
	p = inp.pop(0)
	x = inp
	minim = -1
	maxim = -1
	above_g = sum(x[g:])
	if above_g < p:
		minim = 1
	elif above_g == p:
		minim = 2
	else:
		minim = math.floor(above_g / p) + 1
	with_g = above_g + x[g - 1]
	if with_g <= p:
		maxim = 1
	else:
		maxim = math.ceil(with_g / p)
	print(str(minim) + ' ' + str(maxim))
	t -= 1


import math
for t in range(int(input())):
	gpx = list(map(int, input().split()))
	g = int(gpx[0])
	p = int(gpx[1])
	x = gpx[2:]
	summ = sum(x[g:])
	remain = summ // p
	minn = remain + 1
	maxx = math.ceil((summ + x[g - 1]) / p)
	print(minn, maxx)


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	(g, p) = (l[0], l[1])
	x = l[2:]
	org_arr = x
	before_sum = 0
	for i in range(g, 10):
		before_sum += org_arr[i]
	min_days = int(before_sum / p) + 1
	g_count = org_arr[g - 1]
	temp_1 = int((g_count + before_sum) / p)
	if temp_1 * p == g_count + before_sum:
		max_days = temp_1
	else:
		max_days = temp_1 + 1
	print('{} {}'.format(min_days, max_days))


from math import ceil
for tc in range(int(input())):
	X = list(map(int, input().split()))
	G = X.pop(0)
	P = X.pop(0)
	X.insert(0, 0)
	req1 = sum(X[G + 1:])
	req2 = sum(X[G:])
	print(ceil((req1 + 1) / P), ceil(req2 / P))


import math
for _ in range(int(input())):
	l = list(map(int, input().split()))
	g = l[0]
	p = l[1]
	s = 0
	for i in range(g + 2, 12):
		s = s + l[i]
	a = s // p
	sum = l[g + 1] + s % p
	print(a + 1, end=' ')
	print(a + math.ceil(sum / p))


import math
for _ in range(int(input())):
	n = 0
	a = list(map(int, input().split()))
	(x, p) = (a[0], a[1])
	for i in range(x + 2, 12):
		n += a[i]
	m = n // p
	sum = a[x + 1] + n % p
	print(m + 1, end=' ')
	print(m + math.ceil(sum / p))


(n, l) = (int(input()), [])
for j in range(n):
	m = list(map(int, input().strip().split()))
	lo = (sum(m[m[0] + 2:]) + 1) // m[1]
	lo = lo + 1 if (sum(m[m[0] + 2:]) + 1) % m[1] != 0 else lo
	u = sum(m[m[0] + 1:]) // m[1]
	u = u + 1 if sum(m[m[0] + 1:]) % m[1] != 0 else u
	l.append([lo, u])
for i in l:
	print(i[0], ' ', i[1])


import math
try:
	for _ in range(int(input())):
		l = list(map(int, input().split()))
		g = l[0]
		p = l[1]
		v = l[2:]
		sum = 0
		for i in range(g, 10):
			sum += v[i]
		ans = sum // p
		flag = v[g - 1] + sum % p
		min = ans + 1
		max = ans + math.ceil(flag / p)
		print(min, max)
except:
	pass


fin = []
for _ in range(int(input())):
	lst = list(map(int, input().split()))
	(g, p) = (lst[0] - 1, lst[1])
	lst.pop(0)
	lst.pop(0)
	minn = round((1 + sum(lst[g + 1:])) / p + 0.4999999)
	maxx = round(sum(lst[g:]) / p + 0.4999999)
	print(minn, maxx)


import math
for _ in range(int(input())):
	lst = list(map(int, input().split()))
	g = lst[0]
	p = lst[1]
	days = 0
	left = 0
	total = 0
	c = 0
	age = lst[g + 1]
	for i in range(g + 2, 12):
		c += 1
		total += lst[i]
	days = total // p
	left = total % p
	mini = maxi = 0
	s = age + left
	print(days + 1, end=' ')
	print(days + math.ceil(s / p))


t = int(input())
for _ in range(t):
	X = list(map(int, input().split()))
	(i, k) = (11, 0)
	(g, p) = (X[0], X[1])
	while i > g + 1:
		k += X[i]
		i -= 1
	d_min = (k + p) // p
	d_max = (k + X[g + 1]) // p
	if (k + X[g + 1]) % p != 0:
		d_max += 1
	print(d_min, d_max)


import math
for _ in range(int(input())):
	ls = list(map(int, input().split()))
	summ = 0
	for i in range(ls[0] + 2, len(ls)):
		summ += ls[i]
	minim = math.ceil((summ + 1) / ls[1])
	maxm = math.ceil((summ + ls[ls[0] + 1]) / ls[1])
	print(minim, maxm)
	summ = 0


import math
n = int(input())
for i in range(n):
	m = list(map(int, input().split()))
	sum = 0
	for i in range(10 - m[0]):
		sum += m[11 - i]
	if sum % m[1] == 0:
		print(math.ceil(sum / m[1]) + 1, end=' ')
		print(math.ceil((sum + m[m[0] + 1]) / m[1]))
	else:
		print(math.ceil(sum / m[1]), end=' ')
		print(math.ceil((sum + m[m[0] + 1]) / m[1]))