You are given two integers $n$ and $k$.

You should create an array of $n$ positive integers $a_1, a_2, \dots, a_n$ such that the sum $(a_1 + a_2 + \dots + a_n)$ is divisible by $k$ and maximum element in $a$ is minimum possible.

What is the minimum possible maximum element in $a$?


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases.

The first and only line of each test case contains two integers $n$ and $k$ ($1 \le n \le 10^9$; $1 \le k \le 10^9$).


-----Output-----

For each test case, print one integer — the minimum possible maximum element in array $a$ such that the sum $(a_1 + \dots + a_n)$ is divisible by $k$.


-----Examples-----

Input
4
1 5
4 3
8 8
8 17
Output
5
2
1
3


-----Note-----

In the first test case $n = 1$, so the array consists of one element $a_1$ and if we make $a_1 = 5$ it will be divisible by $k = 5$ and the minimum possible.

In the second test case, we can create array $a = [1, 2, 1, 2]$. The sum is divisible by $k = 3$ and the maximum is equal to $2$.

In the third test case, we can create array $a = [1, 1, 1, 1, 1, 1, 1, 1]$. The sum is divisible by $k = 8$ and the maximum is equal to $1$.

Difficulty: EASY
Tags: Sorting

Constructive algorithms

Mathematics

Greedy algorithms
Skill types: Sorting

Greedy algorithms

Starter code:

Solutions:
for _ in range(int(input())):
	(q, d) = list(map(int, input().split()))
	if q == 1:
		print(d)
	elif q == d or d == 1:
		print(1)
	elif q > d:
		(k, r) = (q // d, q % d)
		if r == 0:
			print(1)
		else:
			print(2)
	else:
		(k, r) = (d // q, d % q)
		if r == 0:
			print(k)
		else:
			print(k + 1)


t = int(input())
for i in range(t):
	(n, k) = [int(s) for s in input().split()]
	if n > k:
		x = (n - 1) // k
		k += k * x
	if k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)


import math
for i in range(int(input())):
	(x, y) = map(int, input().split())
	if x > y:
		y = y * math.ceil(x / y)
		print(math.ceil(y / x))
	elif y > x:
		print(math.ceil(y / x))
	else:
		print('1')


for _ in [*open(0)][1:]:
	(x, y) = map(int, _.split())
	print(-(-x // y * y // x))


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))

def take():
	stdin = open('input.txt', 'r')
	stdout = open('output.txt', 'w')
num = int(z())
for _ in range(num):
	(n, k) = zzz()
	if n <= k:
		t = ceil(k / n)
		print(t)
	elif n % k == 0:
		print(1)
	else:
		print(2)


def max_element(n, k):
	sum = (n - 1) / k + 1
	sum = int(sum)
	sum *= k
	return int((sum - 1) / n + 1)
test_cases = int(input())
string = ''
for i in range(test_cases):
	string += input() + '\n'
num = string.split()
num = [int(i) for i in num]
for i in range(test_cases):
	print(max_element(num[2 * i], num[2 * i + 1]))


import sys
LI = lambda : list(map(int, sys.stdin.readline().split()))
MI = lambda : map(int, sys.stdin.readline().split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline())
for _ in range(II()):
	(n, k) = MI()
	if n > k:
		k *= n // k + (n % k != 0)
	print(k // n + (k % n != 0))


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if b < a:
		b = b * math.ceil(a / b)
	print(math.ceil(b / a))


import math
t = int(input())
ans = []
for i in range(t):
	nk = [int(j) for j in input().split()]
	if nk[1] == 1:
		ans.append(1)
		continue
	if nk[0] == nk[1]:
		ans.append(1)
	elif nk[1] > nk[0]:
		ans.append(math.ceil(nk[1] / nk[0]))
	elif nk[0] % nk[1] == 0:
		ans.append(1)
	else:
		ans.append(2)
for i in ans:
	print(i)


import math

def ceil(a, b):
	return a // b + (a % b != 0)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	d = ceil(n, k) * k
	print(ceil(d, n))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % k == 0:
		print(1)
	else:
		print(max(2, (n + k - 1) // n))


import math

def chk(k, n):
	x = k / n
	if x == int(x):
		return 0
	else:
		return 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == k:
		print(1)
		continue
	if n > k:
		if n % k == 0:
			print(1)
			continue
		else:
			print(2)
			continue
	print(k // n + chk(k, n))


import sys
import heapq
from collections import deque
MOD = 1000000007

def primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]

def factor(n, l, d):
	F = False
	for p in l:
		if n % p == 0:
			if p in d:
				d[p] += 1
			else:
				d[p] = 1
			F = True
			break
	if F:
		factor(n // p, l, d)

def find(parent, i):
	if parent[i] != i:
		parent[i] = find(parent, parent[i])
	return parent[i]

def union(parent, rank, xx, yy):
	x = find(parent, xx)
	y = find(parent, yy)
	if rank[x] > rank[y]:
		parent[y] = x
	elif rank[y] > rank[x]:
		parent[x] = y
	else:
		parent[y] = x
		rank[x] += 1
ans = 0
n = int(sys.stdin.readline().strip())
for j in range(n):
	l = [0]
	ans = 1
	c = 0
	pre = 0
	AB = sys.stdin.readline().strip().split()
	N = int(AB[0])
	K = int(AB[1])
	if N > K:
		if N % K == 0:
			ans = 1
		else:
			ans = 2
	else:
		ans = (K - 1) // N + 1
	print(ans)


from math import trunc

def solve():
	(n, k) = map(int, input().split())
	c = trunc((n + k - 1) / k)
	k *= c
	o = trunc((k + n - 1) / n)
	print(o)
tests = int(input())
while tests > 0:
	solve()
	tests = tests - 1


t = int(input())
import math
for _ in range(t):
	(n, k) = map(int, input().split())
	if k < n:
		temp = k
		k = k * (n // k)
		if n % temp != 0:
			k += temp
	div = k // n
	rem = k % n
	ans = div + math.ceil(rem / n)
	print(ans)


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

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

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

def li():
	return [int(i) for i in 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=2):
	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):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def function(arr, size, dp):
	if size == 1 or size == 0:
		return 1
	key = ''.join(map(str, arr[:size]))
	if dp[key]:
		return dp[key]
	output = function(arr, size - 1, dp)
	key = ''.join(map(str, arr[:size - 1]))
	dp[key] = output
	if arr[size - 2] * 10 + arr[size - 1] <= 26:
		output += function(arr, size - 2, dp)
		key = ''.join(map(str, arr[:size - 2]))
		dp[key] = output
	return output

def function(arr, s, n, dp):
	if s == 0:
		return 0
	if n == 0 and s != 0:
		return s
	if dp[n][s] != 0:
		return dp[n][s]
	if arr[n - 1] <= s:
		dp[n][s] = max(arr[n - 1], function(arr, s - arr[n - 1], n - 1, dp), function(arr, s, n - 1, dp))
		return dp[n][s]
	else:
		dp[n][s] = function(arr, s, n - 1, dp)
		return dp[n][s]

def main():
	for _ in range(ii()):
		(n, k) = mi()
		start = 1
		if n > k:
			if n % k == 0:
				end = n
			else:
				end = n + k - n % k
			k = end
		else:
			end = k
		while start <= end:
			mid = (start + end) // 2
			if mid * n >= k:
				ans = mid
				end = mid - 1
			else:
				start = mid + 1
		print(ans)
main()


import math
tt = int(input())
for case in range(tt):
	(n, k) = map(int, input().split())
	if n > k:
		c = math.ceil(n / k)
		k = k * c
	d = math.ceil(k / n)
	print(d)


from math import *
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k >= n:
		print(ceil(k / n))
	elif n % k == 0:
		print(1)
	else:
		print(2)


import sys, io, os
from math import ceil
if os.environ['USERNAME'] == 'kissz':
	inp = open('in.txt', 'r').readline

	def debug(*args):
		print(*args, file=sys.stderr)
else:
	inp = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

	def debug(*args):
		pass
for _ in range(int(inp())):
	(n, k) = map(int, inp().split())
	if n > k:
		if n % k:
			print(2)
		else:
			print(1)
	else:
		print(ceil(k / n))


import math
n = int(input())
for _ in range(n):
	(a, b) = [int(i) for i in input().split()]
	if a <= b:
		print(math.ceil(b / a))
	else:
		d = b * math.ceil(a / b)
		print(math.ceil(d / a))


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n > k:
		print(1 if n % k == 0 else 2)
	elif n == k:
		print(1)
	else:
		print(k // n + (0 if k % n == 0 else 1))


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

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

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

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def ceil(a, b):
	return (a + b - 1) // b

def solve():
	for _ in range(ii()):
		(n, k) = mi()
		if n > k:
			k = ceil(n, k) * k
		print(ceil(k, n))
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().strip().split(' '))
	k = (n + k - 1) // k * k
	print((k + n - 1) // n)


import math
import sys

class Input:

	@staticmethod
	def string():
		return str(input())

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

class Output:

	@staticmethod
	def print(res):
		print(res)

	@staticmethod
	def string(res):
		print(str(res))

	@staticmethod
	def list(res):
		print(' '.join((str(x) for x in res)))

class Algorithms:

	@staticmethod
	def isPrime(n):
		return all((n % i != 0 for i in range(2, int(math.sqrt(n) + 1))))

	@staticmethod
	def getPrimeNumbers(n):
		a = [1]
		for num in range(2, n):
			if all((num % i != 0 for i in range(2, int(math.sqrt(num) + 1)))):
				a.append(num)
		return a

	@staticmethod
	def factorization(n):
		res = {}
		for i in range(2, n * n):
			cnt = 0
			while n % i == 0:
				cnt += 1
				n = n / i
			if cnt > 0:
				res[i] = cnt
		if n > 1:
			res[n] = 1
		return res

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		else:
			a = a % b
			return Algorithms.gcd(b, a)

	@staticmethod
	def lcm(a, b):
		return abs(a * b) // Algorithms.gcd(a, b)

	@staticmethod
	def fibonacci(n):
		a = [0, 1]
		for i in range(2, n + 1):
			a.append(a[i - 1] - a[i - 2])
		return a[n]

	@staticmethod
	def z_func(s):
		n = len(s)
		z = [0] * n
		l = r = 0
		for i in range(1, n):
			if r >= i:
				z[i] = min(z[i - l], r - i + 1)
			while z[i] + i < n and s[z[i]] == s[z[i] + i]:
				z[i] += 1
			if i + z[i] - 1 > r:
				l = i
				r = i + z[i] - 1
		return z

def solve():
	(n, m) = Input.list_int()
	if n == 1:
		print(m)
	elif n > m:
		m = m * math.ceil(n / m)
		print(math.ceil(m / n))
	else:
		print(math.ceil(m / n))
query_count = Input.int()
while query_count:
	query_count -= 1
	solve()


import math
t = int(input())
(n_l, k_l) = ([], [])
for _ in range(t):
	l = input().split(' ')
	n_l.append(int(l[0]))
	k_l.append(int(l[1]))
for i in range(t):
	temp = k_l[i]
	if n_l[i] > k_l[i]:
		k_l[i] = math.ceil(n_l[i] / k_l[i]) * k_l[i]
	print(math.ceil(k_l[i] / n_l[i]))


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	if k % n == 0:
		print(k // n)
	elif n % k == 0:
		print(1)
	elif k < n:
		print(2)
	else:
		print(k // n + 1)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n > k:
		el = 1
	else:
		el = k // n
	ans = el
	k *= math.ceil(el * n / k)
	dif = k - el * n
	if dif == 0:
		ans = el
	elif dif <= n:
		ans += 1
	else:
		x = dif % n
		if x != 0:
			ans += dif // n + 1
	print(ans)


import math
tc = int(input())
for i in range(tc):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	if k >= n:
		print(int(math.ceil(k / n)))
	else:
		upn = int(math.ceil(n / k))
		k2 = upn * k
		print(int(math.ceil(k2 / n)))


from sys import stdin
import math

def readint():
	return int(stdin.readline())

def readarray(typ):
	return list(map(typ, stdin.readline().split()))
for _ in range(readint()):
	(n, k) = map(int, input().split())
	if k >= n:
		print(math.ceil(k / n))
	elif n % k == 0:
		print(1)
	else:
		print(2)


import sys
t = int(input().strip())
for i in range(t):
	(n, k) = map(int, input().strip().split())
	cf = (n + k - 1) // k
	a_max = (cf * k + n - 1) // n
	print(a_max)


import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	if k < n:
		if n % k == 0:
			k = n
		else:
			k = (n // k + 1) * k
	if k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)


t = int(input())
i = 0
ans = []
while t > 0:
	(n, k) = map(int, input().split())
	if n == k or k == 1:
		ans.append(1)
	elif n < k:
		a = k % n
		b = int(k / n)
		if a != 0:
			b += 1
		ans.append(b)
	elif n > k:
		c = n / k
		d = n % k
		if d != 0:
			c += 1
		k *= c
		a = k % n
		b = int(k / n)
		if a != 0:
			b += 1
		ans.append(b)
	t -= 1
	i += 1
for i in ans:
	print(i)


from math import ceil
t = int(input())
pairs = [list(map(int, input().split())) for i in range(t)]
for (n, k) in pairs:
	sum_a = ceil(n / k) * k
	y = ceil(sum_a / n)
	print(y)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
import bisect
import math as mt
from types import GeneratorType
BUFSIZE = 8192

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
import sys
from math import ceil, log2
INT_MAX = sys.maxsize
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections as col
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def minVal(x, y):
	return x if x < y else y

def getMid(s, e):
	return s + (e - s) // 2

def RMQUtil(st, ss, se, qs, qe, index):
	if qs <= ss and qe >= se:
		return st[index]
	if se < qs or ss > qe:
		return INT_MAX
	mid = getMid(ss, se)
	return minVal(RMQUtil(st, ss, mid, qs, qe, 2 * index + 1), RMQUtil(st, mid + 1, se, qs, qe, 2 * index + 2))

def RMQ(st, n, qs, qe):
	if qs < 0 or qe > n - 1 or qs > qe:
		print('Invalid Input')
		return -1
	return RMQUtil(st, 0, n - 1, qs, qe, 0)

def constructSTUtil(arr, ss, se, st, si):
	if ss == se:
		st[si] = arr[ss]
		return arr[ss]
	mid = getMid(ss, se)
	st[si] = minVal(constructSTUtil(arr, ss, mid, st, si * 2 + 1), constructSTUtil(arr, mid + 1, se, st, si * 2 + 2))
	return st[si]

def constructST(arr, n):
	x = int(ceil(log2(n)))
	max_size = 2 * int(2 ** x) - 1
	st = [0] * max_size
	constructSTUtil(arr, 0, n - 1, st, 0)
	return st
MOD = 10 ** 9 + 7
mod = 10 ** 9 + 7
p = 10 ** 9 + 7

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def z_array(s1):
	n = len(s1)
	z = [0] * n
	(l, r, k) = (0, 0, 0)
	for i in range(1, n):
		if i > r:
			(l, r) = (i, i)
			while r < n and s1[r - l] == s1[r]:
				r += 1
			z[i] = r - l
			r -= 1
		else:
			k = i - l
			if z[k] < r - i + 1:
				z[i] = z[k]
			else:
				l = i
				while r < n and s1[r - l] == s1[r]:
					r += 1
				z[i] = r - l
				r -= 1
	return z

def fs(x):
	if x < 2:
		return 0
	return x * (x - 1) // 2
t = int(input())

def solve():
	k1 = (n + k - 1) // k
	return (k * k1 + n - 1) // n
for _ in range(t):
	(n, k) = map(int, input().split())
	print(solve())


t = int(input())
for _ in range(t):
	inp = input().split()
	n = int(inp[0])
	k = int(inp[1])
	dv = k // n
	if dv > 0:
		if k % n > 0:
			dv += 1
		print(dv)
	else:
		vd = n // k
		if n % k > 0:
			vd += 1
		k *= vd
		dv = k // n
		if k % n > 0:
			dv += 1
		print(dv)


import math
for i in range(int(input())):
	inp = list(map(int, input().split()))
	n = inp[0]
	k = inp[1]
	if k < n:
		a = n // k + (n % k > 0)
		print(a * k // n + (a * k % n > 0))
	else:
		print(k // n + (k % n > 0))


for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	k = ((n - 1) // k + 1) * k
	print((k - 1) // n + 1)


k = int(input())
while k > 0:
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	if a == b or a % b == 0:
		print(1)
	elif a > b:
		print(2)
	elif b / a > round(b / a):
		print(round(b / a) + 1)
	else:
		print(round(b / a))
	k -= 1


import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if k >= n:
		print(math.ceil(k / n))
	else:
		p = math.ceil(n / k)
		print(math.ceil(k * p / n))


t = int(input())
while t:
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	if n > k:
		if n % k == 0:
			a = 1
		else:
			a = 2
	if n <= k:
		a = k // n
		if k % n != 0:
			a += 1
	print(a)
	t -= 1


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	if k < n:
		if n % k == 0:
			k = n
		else:
			k = (n // k + 1) * k
	if k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)


t = int(input())
for i in range(0, t):
	(n, k) = [int(j) for j in input().split()]
	if n > k and n % k != 0:
		k += n - n % k
	elif n > k and n % k == 0:
		k = n
	if k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == m:
		print(1)
	elif n == 1:
		print(m)
	elif m % n == 0:
		print(m // n)
	elif n % m == 0:
		print(1)
	elif m < n:
		p = n // m
		q = (p + 1) * m
		print(q // n + 1)
	else:
		p = m // n
		print(p + 1)


import math
queries = []
ks = []
n = int(input())
for i in range(n):
	x = list(map(int, input().split()))
	queries.append(x)
for q in queries:
	if q[1] < q[0]:
		q[1] *= math.ceil(q[0] / q[1])
	print(math.ceil(q[1] / q[0]))


import sys, math
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	if n % k == 0:
		print(1)
	elif k < n:
		print(2)
	else:
		v = math.ceil(k / n)
		print(v)


from collections import defaultdict
import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n == k:
		print(1)
	elif n < k:
		print(math.ceil(k / n))
	else:
		x = int((n + k - 1) / k)
		k = k * x
		print((k + n - 1) // n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	z = n // k + (n % k != 0)
	y = z * k
	print(y // n + (y % n != 0))


t = int(input())
while t:
	(n, k) = [int(i) for i in input().split()]
	if n % k == 0:
		print(1)
	elif n > k:
		print(2)
	elif k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)
	t -= 1


import math

def min_a(n, k):
	temp = k * math.ceil(n / k)
	if temp % n == 0:
		a = temp // n
	else:
		a = temp // n + 1
	return a
t = input()
for i in range(int(t)):
	s = input().split()
	(n, k) = (int(s[0]), int(s[1]))
	print(min_a(n, k))


n = int(input())
for i in range(n):
	(p, q) = map(int, input().split())
	if p <= q:
		if q % p == 0:
			a = q / p
		else:
			a = (q - q % p) / p + 1
		print(int(a))
	if p > q and p % q != 0:
		q = p - p % q + q
		a = (q - q % p) / p + 1
		print(int(a))
	if p > q and p % q == 0:
		q = p - p % q
		a = q / p
		print(int(a))


for g in [*open(0)][1:]:
	(n, k) = map(int, g.split())
	print(((k + n - 1) // n, 2 - (n % k == 0))[k < n])


import math
t = int(input())
for te in range(t):
	(n, k) = list(map(int, input().split(' ')))
	if n == k:
		print(1)
	elif n == 1:
		print(k)
	elif k > n:
		diff = k - n
		ratio = diff / n
		c = math.ceil(ratio)
		print(1 + c)
	elif n > k:
		i = k
		k = math.ceil(n / k) * k
		diff = k - n
		ratio = diff / n
		c = math.ceil(ratio)
		print(1 + c)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n == 1:
		print(k)
	elif n < k:
		a = k // n
		b = k % n
		if b != 0:
			a += 1
		print(a)
	elif n == k:
		print(1)
	else:
		c = n // k
		d = n % k
		if d != 0:
			c += 1
		k *= c
		a = k // n
		b = k % n
		if b != 0:
			a += 1
		print(a)


import math

def solve(n, k):
	if n % k == 0:
		return 1
	if k > n:
		return int(math.ceil(k / n))
	return 2
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	print(solve(n, k))


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def main():
	try:
		from math import ceil
		for _ in range(inp()):
			(n, k) = invr()
			if k >= n:
				print(ceil(k / n))
			elif n % k == 0:
				print(1)
			else:
				print(2)
	except Exception as e:
		print(e)
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()


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	n = l[0]
	k = l[1]
	ans = 0
	if k >= n:
		if k % n == 0:
			x = k / n
			print(int(x))
		else:
			x = k // n
			print(x + 1)
	elif n % k == 0:
		print(1)
	else:
		print(2)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k = k * ((n - 1) // k + 1)
	v = k // n
	if v == 0 or v * n != k:
		print(v + 1)
	else:
		print(v)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n > k:
		g = math.ceil(n / k)
		print(math.ceil(k * g / n))
	else:
		print(math.ceil(k / n))


def kdivisible(n, k):
	import math
	if n == k:
		print(1)
	elif n > k:
		print(math.ceil(math.ceil(n / k) * k / n))
	else:
		print(math.ceil(k / n))
T = int(input())
while T > 0:
	(n, k) = list(map(int, input().split()))
	kdivisible(n, k)
	T = T - 1


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda : list(map(int, sys.stdin.readline().rstrip('\r\n').split()))
mod = 10 ** 9 + 7
Mod = 998244353
INF = float('inf')
from collections import Counter as cc
tc = 1
(tc,) = inp()
for _ in range(tc):
	(n, k) = inp()
	k = k * ((n + k - 1) // k)
	print((n + k - 1) // n)


import sys
t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	k = k * ((n + k - 1) // k)
	ans = (k + n - 1) // n
	print(ans)


from math import ceil

def fun(ls):
	n = ls[0]
	k = ls[1]
	if n <= k:
		print(ceil(k / n))
	else:
		if k == 1:
			print(1)
			return
		if n % k == 0:
			print(1)
			return
		else:
			print(2)
T = int(input())
for i in range(T):
	ls = list(map(int, input().split()))
	fun(ls)


from math import ceil
t = int(input())
for i in range(t):
	[n, k] = map(int, input().split())
	if n < k:
		print(ceil(k / n))
	elif n > k:
		if n % k:
			print(2)
		else:
			print(1)
	else:
		print(1)


from math import floor, log2, ceil
t = int(input())
res = []
prev = ''
for _ in range(t):
	[n, k] = list(map(int, input().split()))
	if n < k:
		res.append(ceil(k / n))
	elif n % k == 0:
		res.append(1)
	else:
		res.append(2)
for index in range(t):
	print(res[index])


t = int(input())

def f(n, k):
	if n == k:
		res = 1
	else:
		(a, b) = (k // n, k % n)
		res = a if b == 0 else a + 1
	return res
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	if n > k:
		(a, b) = (n // k, n % k)
		k = a * k if b == 0 else (a + 1) * k
	res = f(n, k)
	print(res)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	K = k
	if n > k:
		if n % k != 0:
			k = n + k - n % k
		else:
			k = n
	if k % n != 0:
		k += n - k % n
	print(k // n)


for s in [*open(0)][1:]:
	(n, k) = map(int, s.split())
	print(0 - -n // k * k // n)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % k == 0:
		a = n // k
	else:
		a = n // k + 1
	k = a * k
	if k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)


import sys
input = sys.stdin.readline

def solve():
	(n, k) = map(int, input().split())
	if n < k:
		v = k // n
		v += 1 if k % n else 0
	elif n % k == 0:
		v = 1
	else:
		v = 2
	return v
for _ in range(int(input())):
	print(solve())


for _ in range(int(input().strip())):
	(n, k) = map(int, input().strip().split())
	if k == 1:
		print(1)
	elif n == k or n % k == 0:
		print(1)
	elif n > k:
		print(2)
	elif k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)


def main():
	t = int(input())
	allAns = []
	for _ in range(t):
		(n, k) = readIntArr()
		if n < k:
			ans = (k + n - 1) // n
		elif n % k == 0:
			ans = 1
		else:
			ans = 2
		allAns.append(ans)
	multiLineArrayPrint(allAns)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
main()


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	cf = (n + k - 1) // k
	k *= cf
	print((k + n - 1) // n)


from collections import Counter
from math import factorial as fac
import math
import bisect
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n > k:
		k = math.ceil(n / k) * k
	print(math.ceil(k / n))


tot = int(input())
for x in range(tot):
	(n, k) = map(int, input().split(' '))
	exs = 0
	p = n / k
	if int(p) - p == 0:
		exs = int(p) * k
	else:
		exs = int(p + 1) * k
	p = exs / n
	if int(p) - p == 0:
		print(int(p))
	else:
		print(int(p + 1))


T = int(input())
r = 1
while r <= T:
	(n, k) = map(int, input().split())
	if k >= n:
		ans = (k - 1) // n + 1
	elif n % k == 0:
		ans = 1
	else:
		ans = 2
	print(ans)
	r += 1


import sys

def solve(N, K):
	if N == 1:
		return K
	res = int((K - 1) / N) + 1
	if N % K != 0:
		res = max(2, res)
	return res

def run():
	out = ''
	T = int(input())
	for i in range(T):
		(N, K) = [int(x) for x in input().split()]
		print(solve(N, K))
run()


def f(n, k):
	if n >= k:
		if n % k == 0:
			return 1
		else:
			return 2
	elif k % n == 0:
		return k // n
	else:
		return k // n + 1
m = []
x = int(input())
for i in range(x):
	y = input()
	y1 = y.split(' ')
	y2 = [int(t) for t in y1]
	m.append(y2)
for j in range(x):
	print(f(m[j][0], m[j][1]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == 1:
		print(k)
	elif k == 1:
		print(1)
	elif n == k:
		print(1)
	elif n > k:
		if n % k == 0:
			print(1)
		else:
			tmp = n // k
			k = (tmp + 1) * k
			print(k // n + 1)
	elif n < k:
		if k % n == 0:
			print(k // n)
		else:
			print(k // n + 1)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n == 1:
		print(k)
	else:
		rem = (n + k) % k
		if rem == 0:
			x = n
		else:
			x = n + k - rem
		if x % n == 0:
			print(x // n)
		else:
			print(x // n + 1)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n % k == 0:
		left = 0
	else:
		left = k - n % k
	if left % n != 0:
		j = 2 + left // n
	else:
		j = 1 + left // n
	print(j)


t = int(input())
for i in range(t):
	l = input().split(' ')
	n = int(l[0])
	k = int(l[1])
	if n > k:
		if n % k == 0:
			k = n
		else:
			k = (n // k + 1) * k
	if k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)


import math
cases = int(input())
while cases:
	cases -= 1
	(n, k) = map(int, input().split())
	if k < n:
		k = math.ceil(n / k) * k
	print(math.ceil(k / n))


import math
for tt in range(int(input())):
	(n, k) = map(int, input().split())
	cnt = 1
	cnt = (n + k - 1) // k
	k = k * cnt
	print((n + k - 1) // n)


from sys import *
from math import *
from bisect import bisect_left
input = lambda : stdin.readline()
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)
for _ in range(int(input())):
	(n, k) = get_int()
	val = (n + k - 1) // k
	k *= val
	print((k + n - 1) // n)


t = int(input())
list_ans = []
for i in range(t):
	(n, k) = map(int, input().split())
	k = k * ((n - 1) // k + 1)
	list_ans.append((k - 1) // n + 1)
for item in list_ans:
	print(item)


def maxmin(n, k):
	if n <= k:
		ans = 0
		if k % n == 0:
			ans = k // n
		else:
			ans = k // n + 1
		return ans
	if n > k:
		if n % k == 0:
			i = 1
		else:
			i = 2
		return i
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	print(maxmin(n, k))


import math
T = int(input())
for _ in range(T):
	(n, k) = [int(x) for x in input().split()]
	if n == 1:
		print(k)
	elif n == k:
		print(1)
	elif k > n:
		print(math.ceil(k / n))
	elif k == 1 or n % k == 0:
		print(1)
	else:
		print(2)


def ceil(x):
	y = int(x)
	return y + int(x != y)

def _que_40(N, K):
	if N % K == 0:
		return 1
	return max(2, ceil(K / N))

def que_40():
	for t in range(int(input())):
		(N, K) = map(int, input().split())
		print(_que_40(N, K))
que_40()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n % m == 0:
		print(1)
		continue
	a = m
	if m < n:
		m = m * (n // m) + m
	f = m / n
	if f > int(f):
		print(int(f) + 1)
	else:
		print(int(f))


from math import ceil

def solve(n, k):
	if k < n:
		return 1 + (n % k != 0)
	return ceil(k / n)
t = int(input())
ans = []
for i in range(t):
	(n, k) = map(int, input().split())
	ans.append(solve(n, k))
for i in ans:
	print(i)


t = int(input())
for tes in range(t):
	(n, k) = map(int, input().split(' '))
	if k >= n:
		a = k // n
		if k % n != 0:
			a += 1
	else:
		b = n % k
		a = 1
		if b != 0:
			a += 1
	print(a)


import math
for i in range(int(input())):
	(n, k) = map(int, input().strip().split())
	if k >= n:
		if k % n == 0:
			print(k // n)
		else:
			print(k // n + 1)
	elif n % k == 0:
		print(1)
	else:
		k = k * (n // k + 1)
		print(k // n + 1)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	print(1 + math.ceil((k - n % k) % k / n))


from math import *
T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	K *= ceil(N / K)
	print(ceil(K / N))


answ = []
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = (n // k + (n % k != 0)) * k
	answ.append(a // n + (a % n != 0))
print(*answ, sep='\n')


l = int(input())
for _ in range(l):
	(n, k) = map(int, input().split())
	cf = (n + k - 1) // k
	s = (cf * k + n - 1) // n
	print(s)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	dv = n // k
	if n % k != 0:
		dv += 1
	n1 = dv * k
	ans = n1 // n
	if n1 % n != 0:
		ans += 1
	print(ans)


import math as m
t = int(input())
res = []
for i in range(t):
	(n, k) = map(int, input().split())
	res.append(m.ceil(m.ceil(n / k) * k / n))
for i in res:
	print(i)


import math
t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k > n:
		c = k % n
		res = (k - c) / n
		if c == 0:
			print(int(res))
		elif c > n:
			v = math.ceil(c / n)
			print(int(res + v))
		elif c < n:
			print(int(res + 1))
		else:
			print(int(res))
	elif k == n or k == 1:
		print(1)
	elif n % k == 0:
		print(1)
	else:
		print(2)


from math import ceil
for t in range(int(input())):
	(n, k) = map(int, input().split())
	max_elem = ceil(ceil(n / k) * k / n)
	print(max_elem)


def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		print((k - 1) // n + 1 if n < k else 1 + bool(n % k))
main()


t = int(input())
for i in range(t):
	s = [int(x) for x in input().split()]
	n = s[0]
	k = s[1]
	m = int((n + k - 1) / k)
	k *= m
	answer = int((k + n - 1) / n)
	print(answer)


import math

def solve():
	(n, m) = map(int, input().split())
	print(math.ceil(math.ceil(n / m) * m / n))
for t in range(0, int(input())):
	solve()


m = int(input())
q = []
for i in range(m):
	q.append(list(map(int, input().split())))
for x in q:
	n = x[0]
	k = x[1]
	if k > n:
		if k % n == 0:
			print(k // n)
		else:
			print(k // n + 1)
	if k < n:
		if n % k == 0:
			print(1)
		else:
			tk = k * (n // k + 1)
			print(tk // n + 1)
	if k == n:
		print(1)


l = int(input())

def up_division(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1
for i in range(l):
	(n, k) = list(map(int, input().split()))
	x = up_division(n, k)
	S = k * x
	maks = up_division(S, n)
	print(maks)


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k < n:
		if n % k == 0:
			print(1)
		else:
			print(2)
	elif k == n:
		print(1)
	elif k % n == 0:
		print(k // n)
	else:
		print(k // n + 1)


from sys import stdin
input = stdin.buffer.readline
import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k >= n:
		print(math.ceil(k / n))
	else:
		print(math.ceil(k * math.ceil(n / k) / n))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	b = n + (k - n) % k
	print((b + n - 1) // n)


def do(n, k) -> int:
	if n <= k:
		return k // n + (k % n > 0)
	return 1 + (n % k > 0)
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	print(do(n, k))


from math import *
for i in range(int(input())):
	(n, k) = map(int, input().split())
	if n <= k:
		print(ceil(k / n))
	else:
		xx = ceil(n / k)
		k = k * xx
		print(ceil(k / n))


import math
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	b = math.ceil(a / b) * b
	print(math.ceil(b / a))


import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	if n % k == 0:
		print('1')
	elif n < k:
		r = 1
		t = math.ceil((k - n) / n)
		if t <= 0:
			print(r + 1)
		else:
			print(r + t)
	else:
		r = 1
		t = n % k
		p = math.ceil(t / n)
		if p <= 0:
			print(r + 1)
		else:
			print(r + p)


def round_after(a, b):
	remainder = 0
	if a % b > 0:
		remainder = 1
	return a // b + remainder

def K_divisibleSum(n, k):
	if n == k:
		return 1
	if n > k:
		k = k * round_after(n, k)
	return round_after(k, n)
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	print(K_divisibleSum(n, k))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	i = 0
	if k < n:
		if n % k == 0:
			print(1)
			continue
		else:
			k = k * int(n / k + 1)
	if k % n == 0:
		print(int(k / n))
	else:
		print(int(k / n) + 1)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = n // k + (n % k != 0)
	m = a * k // n + (a * k % n != 0)
	print(m)


import math
t = int(input())
for x in range(t):
	(n, k) = map(int, input().split())
	if n <= k:
		print(math.floor((n + k - 1) / n))
	elif n % k == 0 or n % k == 1:
		print(n % k + 1)
	elif n % k == 2:
		print(n % k)
	else:
		print(n % k - (n % k - 2))


for t in range(int(input())):
	import math
	(n, k) = map(int, input().split())
	if n == 1:
		print(k)
		continue
	if n == k:
		print(1)
		continue
	if n > k:
		x = math.ceil(n // k)
		a = k * x
		dif = a - n
		if dif == 0:
			print(1)
		else:
			print(2)
		continue
	if n < k:
		x = math.ceil(k / n)
		print(x)
		continue


from math import ceil
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	m = int(ceil(n / k))
	k = m * k
	ave = k / n
	print(int(ceil(ave)))


t = int(input())

def kDivisibleSum(n, k):
	if k < n:
		k *= n // k + 1 if n % k else n // k
	return k // n + 1 if k % n else k // n
for _ in range(t):
	(n, k) = (int(x) for x in input().split())
	print(kDivisibleSum(n, k))


for _ in range(int(input())):
	(n, k) = (int(x) for x in input().split())
	if n <= k:
		if k % n == 0:
			print(k // n)
		else:
			print(k // n + 1)
	elif n % k == 0:
		print(1)
	else:
		a = k * (n // k + 1)
		print(a // n + 1)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n > k:
		a = n % k
		if a == 0:
			print(1)
		else:
			print(2)
	else:
		a = k // n
		b = k % n
		if b == 0:
			print(a)
		else:
			print(a + 1)


import math
import collections
import bisect

def solve(n, k):
	if k < n:
		k *= math.ceil(n / k)
	return math.ceil(k / n)
t = int(input())
for t in range(t):
	(n, k) = [int(s) for s in input().split()]
	result = solve(n, k)
	print(result)


import math

def main():
	cases = int(input())
	ans_list = []
	for _ in range(cases):
		(n, k) = map(int, input().split(' '))
		if k < n:
			mult = math.ceil(n / k)
			k *= mult
		ans_list.append(str(int(math.ceil(k / n))))
	print('\n'.join(ans_list))
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')
main()


from math import ceil
for i in range(int(input())):
	(n, k) = map(int, input().split())
	if k < n:
		k *= ceil(n / k)
	m = k / n
	if m % 1 == 0:
		print(int(m))
	else:
		print(ceil(m))


from collections import defaultdict
T = int(input())
for _ in range(T):
	(n, k) = [int(i) for i in input().split()]
	if n % k == 0:
		print(1)
		continue
	x = n // k
	x += 1
	s = x * k
	if s % n == 0:
		print(s // n)
	else:
		print(s // n + 1)


import sys
import math
input = sys.stdin.readline

def _find_max_a(n, k):
	if n == k:
		return 1
	if k == 1:
		return 1
	elif n > k:
		return math.ceil(n / k)
	else:
		return math.ceil(k / n)

def is_a_bar_possible(a_bar, n, k):
	lower_bound = (n - 1 + a_bar) / k
	upper_bound = n * a_bar / k
	return math.ceil(lower_bound) <= math.floor(upper_bound)

def rec_find_a_bar(min_a, max_a, n, k):
	if min_a == max_a:
		return min_a
	new_a_bar = math.floor(min_a + (max_a - min_a) / 2)
	if is_a_bar_possible(new_a_bar, n, k):
		return rec_find_a_bar(min_a, new_a_bar, n, k)
	else:
		return rec_find_a_bar(new_a_bar + 1, max_a, n, k)

def find_a_bar(n, k):
	return rec_find_a_bar(1, k, n, k)
t = int(input())
for item in range(t):
	(n, k) = input().split(' ')
	print(find_a_bar(int(n), int(k)))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	if n <= k:
		print((n + k - 1) // n)
	elif n % k == 0:
		print(1)
	else:
		print(2)


from math import ceil
t = int(input())
for z in range(t):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	x = (k - n % k) % k
	b = ceil(x / n) + 1
	print(b)


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	x = math.ceil(n / k)
	x = x * k
	z = x - x // n * n
	if z != 0:
		z = 1
	print(x // n + z)


t = int(input())
for j in range(0, t):
	l1 = [int(x) for x in input().split()]
	n = l1[0]
	k = l1[1]
	ini_n = n
	val_to_add_to_n = 0
	if n < k:
		val_to_add_to_n = k - n
	else:
		val_to_add_to_n = n % k
	n += val_to_add_to_n
	ans = n // ini_n
	if ans * ini_n == n:
		print(ans)
	else:
		print(ans + 1)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	new_k = k
	if new_k < n:
		if n % new_k != 0:
			new_k *= n // k + 1
	if new_k % n == 0:
		print(new_k // n)
	else:
		print(new_k // n + 1)


import math
import sys
li = []
t = int(input())
while t:
	(n, k) = map(int, sys.stdin.readline().split())
	if n <= k:
		li.append(math.ceil(k / n))
	elif n % k == 0:
		li.append(1)
	else:
		li.append(2)
	t = t - 1
for i in li:
	print(i)


from math import ceil
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	b = int(ceil(a / b)) * b
	print(int(ceil(b / a)))


for i in range(int(input())):
	(n, k) = map(int, input().split())
	ku = k + k * ((n - k) // k)
	if ku < n:
		ku += k
	maxm = ku // n
	if ku % n != 0:
		maxm += 1
	print(maxm)


for t in range(int(input())):
	(n, k) = [int(k) for k in input().split()]
	if k < n:
		k *= int((n - 1) / k) + 1
	print((k - 1) // n + 1)


from math import ceil

def answer():
	v = ceil(n / k)
	return ceil(v * k / n)
for T in range(int(input())):
	(n, k) = map(int, input().split())
	print(answer())


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def isInt(s):
	return '0' <= s[0] <= '9'
MOD = 10 ** 9 + 7

def solve():
	(N, K) = getInts()
	if N == K:
		return 1
	if N < K:
		return K // N + (K % N > 0)
	if N % K == 0:
		return 1
	return 2
for _ in range(getInt()):
	print(solve())


def solve():
	(n, k) = map(int, input().split())
	if n > k:
		if n % k == 0:
			return 1
		else:
			return 2
	if k % n == 0:
		return k // n
	else:
		return k // n + 1
for _ in range(int(input())):
	print(solve())


import sys

def solution(n: int, k: int):
	if k % n == 0:
		return k // n
	elif n <= k:
		return k // n + 1
	elif n % k == 0:
		return 1
	else:
		k = (n // k + 1) * k
		return k // n + 1
if sys.argv[-1] == 't':
	for d in [[1, 5, 5], [2, 5, 3], [5, 3, 2], [4, 3, 2], [8, 8, 1], [4, 8, 2], [8, 4, 1], [3, 5, 2]]:
		result = solution(d[0], d[1])
		if result != d[-1]:
			print(d, result)
else:
	for _ in range(int(input())):
		(n, k) = [int(d) for d in input().split(' ')]
		print(solution(n, k))


import math
t = int(input())
for z in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	i = k
	d = n - k
	d1 = int(d / k)
	r = int(d % k)
	if r > 0:
		d1 += 1
	if k < n:
		k += d1 * k
	print(math.ceil(k / n))


import sys
inf = sys.stdin
input = inf.readline

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

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split(' ')]
	return res
from itertools import permutations

def check_seq(n, k):
	if k == n:
		return 1
	if k > n:
		res = k // n
		if k % n:
			res += 1
		return res
	if not n % k:
		res = 1
	else:
		res = 2
	return res

def main():
	samples = read_one_int()
	res = ''
	for _ in range(samples):
		n_k = read_list_of_ints()
		res = check_seq(n_k[0], n_k[1])
		print(res)
main()


from __future__ import print_function
from collections import Counter, OrderedDict
from itertools import permutations as perm
from fractions import Fraction
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
from math import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n, k) = gil()
	if n == k:
		print(1)
	elif n < k:
		print(ceil(k / n))
	else:
		print(2 if n % k else 1)


a = int(input())
for i in range(a):
	(N, K) = map(int, input().split())
	if N <= K:
		if K % N == 0:
			print(K // N)
		else:
			print(K // N + 1)
	elif N % K == 0:
		print(1)
	else:
		temp = N // K
		K = K * (temp + 1)
		if K % N == 0:
			print(K // N)
		else:
			print(K // N + 1)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	cf = (n + k - 1) // k
	a = (cf * k + n - 1) // n
	if n == k:
		print(1)
	else:
		print(a)


import math

def kdiv(n, k):
	if k < n:
		m = math.ceil(n / k)
		return math.ceil(m * k / n)
	return math.ceil(k / n)
num_test_cases = int(input())
for i in range(num_test_cases):
	(n, k) = input().split()
	print(kdiv(int(n), int(k)))


def fn(n, k):
	if n == k:
		print(1)
		return
	if n < k:
		if k % n == 0:
			print(k // n)
		else:
			req = k // n + 1
			print(req)
		return
	elif n % k == 0:
		fn(n, k * n // k)
	else:
		req = n // k + 1
		fn(n, k * req)
z = int(input())
for i in range(0, z):
	(n, k) = list(map(int, input().split(' ')))
	fn(n, k)


cases = int(input().strip())
for i in range(cases):
	(n, k) = map(int, input().strip().split())
	time = 1
	if k < n:
		time = n // k
		if n % k != 0:
			time += 1
	target = time * k
	base = target // n
	if target % n == 0:
		print(int(base))
	else:
		print(int(base + 1))


T = int(input())
for t in range(T):
	(n, k) = tuple([int(x) for x in input().split()])
	result = None
	if k < n:
		if n % k == 0:
			result = 1
		else:
			result = 2
	elif k % n == 0:
		result = k // n
	else:
		result = k // n + 1
	print(result)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	r = k * math.ceil(n / k)
	if r % n == 0:
		print(r // n)
	else:
		print(math.ceil(r / n))


import math
testcase = int(input())

def enter():
	rseq = input()
	rseq = rseq.split(' ')
	rseq = list(map(int, rseq))
	return rseq
while testcase:
	c = 0
	div = enter()
	a = div[1] / div[0]
	if div[1] == 1:
		print(1)
		testcase -= 1
		continue
	if a < 1:
		c = math.ceil(div[0] / div[1])
		a = c * div[1] / div[0]
	print(math.ceil(a))
	testcase -= 1


import math
t = int(input())
for c in range(t):
	(n, k) = map(int, input().split(' '))
	cf = math.ceil(n / k)
	s = cf * k
	r = math.ceil(s / n)
	print(r)


t = int(input())
answer = []
for i in range(t):
	(n, k) = list(map(int, input().split()))
	cf = (n + k - 1) // k
	answer.append(str((cf * k + n - 1) // n))
print('\n'.join(answer))


from math import ceil
t = int(input())
while t:
	(n, k) = map(int, input().split())
	if n <= k:
		print(ceil(k / n))
	else:
		k = ceil(n / k) * k
		print(ceil(k / n))
	t -= 1


import math
for _ in range(int(input())):
	(n, d) = map(int, input().split())
	if n > d:
		if n % d == 0:
			print('1')
		else:
			print('2')
	else:
		print(math.ceil(d / n))


import sys, math

def get_ints():
	return map(int, I().split())

def get_list():
	return list(map(int, I().split()))

def I():
	return sys.stdin.readline()
for _ in range(int(I())):
	(a, b) = get_ints()
	if a == b:
		print(1)
	elif a < b:
		print(math.ceil(b / a))
	else:
		b = b * math.ceil(a / b)
		print(math.ceil(b / a))


import math
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	k = k * ((n + k - 1) // k)
	print((k + n - 1) // n)


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
for _ in range(t()):
	(n, k) = ll()
	if n % k == 0:
		print(1)
	elif n > k:
		print(2)
	else:
		print(k // n + (1 if k % n else 0))


import math
for _ in range(int(input())):
	(nn, kk) = map(int, input().split())
	if nn == kk:
		print(1)
	elif nn == 1:
		print(kk)
	elif kk > nn:
		print(math.ceil(kk / nn))
	elif nn > kk and nn % kk != 0:
		print(2)
	elif nn > kk and nn % kk == 0:
		print(1)