You are fighting with Zmei Gorynich — a ferocious monster from Slavic myths, a huge dragon-like reptile with multiple heads! 

 $m$ 

Initially Zmei Gorynich has $x$ heads. You can deal $n$ types of blows. If you deal a blow of the $i$-th type, you decrease the number of Gorynich's heads by $min(d_i, curX)$, there $curX$ is the current number of heads. But if after this blow Zmei Gorynich has at least one head, he grows $h_i$ new heads. If $curX = 0$ then Gorynich is defeated. 

You can deal each blow any number of times, in any order.

For example, if $curX = 10$, $d = 7$, $h = 10$ then the number of heads changes to $13$ (you cut $7$ heads off, but then Zmei grows $10$ new ones), but if $curX = 10$, $d = 11$, $h = 100$ then number of heads changes to $0$ and Zmei Gorynich is considered defeated.

Calculate the minimum number of blows to defeat Zmei Gorynich!

You have to answer $t$ independent queries.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 100$) – the number of queries.

The first line of each query contains two integers $n$ and $x$ ($1 \le n \le 100$, $1 \le x \le 10^9$) — the number of possible types of blows and the number of heads Zmei initially has, respectively.

The following $n$ lines of each query contain the descriptions of types of blows you can deal. The $i$-th line contains two integers $d_i$ and $h_i$ ($1 \le d_i, h_i \le 10^9$) — the description of the $i$-th blow.


-----Output-----

For each query print the minimum number of blows you have to deal to defeat Zmei Gorynich. 

If Zmei Gorynuch cannot be defeated print $-1$.


-----Example-----
Input
3
3 10
6 3
8 2
1 4
4 10
4 1
3 2
2 6
1 100
2 15
10 11
14 100

Output
2
3
-1



-----Note-----

In the first query you can deal the first blow (after that the number of heads changes to $10 - 6 + 3 = 7$), and then deal the second blow.

In the second query you just deal the first blow three times, and Zmei is defeated. 

In third query you can not defeat Zmei Gorynich. Maybe it's better to convince it to stop fighting?

Difficulty: MEDIUM_HARD

Solutions:
t = int(input())
for _ in range(t):
	(n, x) = list(map(int, input().split()))
	b = [tuple(map(int, input().split())) for i in range(n)]
	shot_gun = b[0]
	uzi = b[0]
	for blow in b:
		if blow[0] > shot_gun[0]:
			shot_gun = blow
		if blow[0] - blow[1] > uzi[0] - uzi[1]:
			uzi = blow
	ans = None
	if shot_gun[0] >= x:
		ans = 1
	elif uzi[0] <= uzi[1]:
		ans = -1
	else:
		ans = 1 + (x - shot_gun[0] + uzi[0] - uzi[1] - 1) // (uzi[0] - uzi[1])
	print(ans)


t = int(input())
for j in range(t):
	(n, x) = list(map(int, input().split()))
	dmax = 0
	smax = 0
	for i in range(n):
		(d, h) = list(map(int, input().split()))
		dmax = max(dmax, d)
		smax = max(smax, d - h)
	if dmax >= x:
		print(1)
	elif smax == 0:
		print(-1)
	else:
		ct = (x - dmax) // smax
		if (x - dmax) % smax != 0:
			ct += 1
		print(ct + 1)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	mr = 0
	mch = 0
	ma = 0
	for j in range(n):
		(d, h) = map(int, input().split())
		if d > mch:
			mch = d
		if d - h > mr or (d - h == mr and d > ma):
			mr = d - h
			ma = d
	ans1 = 0
	if mch >= x:
		print(1)
	elif mr == 0:
		print(-1)
	else:
		ans1 = (x - mch) // mr
		if (x - mch) % mr == 0:
			ans1 += 1
		else:
			ans1 += 2
		print(ans1)


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')

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

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

def N():
	return int(input())

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

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		(n, x) = RL()
		arr = [RLL() for _ in range(n)]
		ma = df = 0
		for (d, h) in arr:
			ma = max(d, ma)
			df = max(df, d - h)
		if x > ma and df <= 0:
			print(-1)
		elif df > 0:
			print(1 + ceil(max(x - ma, 0) / df))
		else:
			print(1)
main()


import math
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	max_damage = max_value = 0
	max_damage_head = max_value_head = 0
	for i in range(n):
		count = 0
		(damage, head) = map(int, input().split())
		if max_value < damage - head:
			max_value = damage - head
			max_value_head = head
		if max_damage < damage:
			max_damage = damage
			max_damage_head = head
	if max_value == 0:
		if max_damage < x:
			print(-1)
		else:
			print(1)
	else:
		if x - max_damage >= 0:
			count = 1 + math.ceil((x - max_damage) / max_value)
		else:
			count = 1
		print(count)


import sys
input = sys.stdin.readline
t = int(input())
for ll in range(t):
	(n, x) = map(int, input().split())
	m = 0
	ma = 0
	z = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		ma = max(d, ma)
		if ma >= x and z == 0:
			print(1)
			z = 1
		m = max(m, d - h)
	else:
		if z == 0:
			if m > 0:
				print((x - ma + m - 1) // m + 1)
			else:
				print(-1)


import math

def solve(init_heads, d, h):
	max_d = max(d)
	max_dh = max((i - j for (i, j) in zip(d, h)))
	b = init_heads - max_d
	if b <= 0:
		return 1
	elif max_dh <= 0:
		return -1
	else:
		return math.ceil(b / max_dh) + 1
assert solve(5, [10, 4], [100, 100]) == 1
assert solve(5, [2, 2], [1, 1]) == 4
assert solve(6, [3, 2], [100, 1]) == 4
x = '3\n3 10\n6 3\n8 2\n1 4\n4 10\n4 1\n3 2\n2 6\n1 100\n2 15\n10 11\n14 100'
source = input
q = int(source())
for t in range(q):
	(n, x) = map(int, source().split())
	(d, h) = ([], [])
	for _ in range(n):
		(di, hi) = map(int, source().split())
		d.append(di)
		h.append(hi)
	print(solve(x, d, h))


import math
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	m = md = 0
	for j in range(n):
		(d, h) = map(int, input().split())
		m = max(m, d)
		md = max(md, d - h)
	if md <= 0:
		if m >= x:
			print(1)
		else:
			print(-1)
	else:
		s = 1 + max(0, math.ceil((x - m) / md))
		print(s)


n = int(input())
for i in range(n):
	(n, x) = map(int, input().split())
	(D, H, DH) = ([], [], [])
	for j in range(n):
		(d, h) = map(int, input().split())
		D.append(d)
		H.append(h)
		DH.append((d, h))
	D_max = sorted(D)[-1]
	bestvalue = sorted(DH, key=lambda x: x[0] - x[1])[-1]
	bestvalue = bestvalue[0] - bestvalue[1]
	if x > D_max:
		if bestvalue <= 0 and D_max < x:
			print(-1)
		else:
			calc = (x - min(x, D_max) + (bestvalue - 1)) // bestvalue
			print(calc + 1)
	else:
		print(1)


def read(t=int):
	return list(map(t, input().strip().split(' ')))
t = read()[0]
while t:
	t -= 1
	(n, x) = read()
	blows = []
	ds = []
	for i in range(n):
		(d, h) = read()
		blows.append((h - d, h))
		ds.append(d)
	blows.sort()
	ds.sort()
	w = blows[0]
	h = ds[-1]
	x -= h
	x = max(0, x)
	if w[0] >= 0 and x != 0:
		print(-1)
	elif w[0] == 0:
		print(1)
	else:
		m = abs(w[0])
		res = 1
		res += (x + m - 1) // m
		print(res)


import math
t = int(input())
for q in range(t):
	(n, x) = map(int, input().split())
	eff = [None] * n
	for i in range(n):
		(d, h) = map(int, input().split())
		eff[i] = [d, h]
	max_eff = max(eff, key=lambda v: v[0] - v[1])
	max_last = max(eff, key=lambda v: v[0])[0]
	d = max_eff[0] - max_eff[1]
	if x <= max_last:
		print(1)
	elif d <= 0:
		print(-1)
	else:
		print(math.ceil((x - max_last) / d) + 1)


import sys
from math import ceil
input = sys.stdin.readline
for i in range(int(input())):
	(n, x) = map(int, input().split())
	res = -1
	blow = list()
	f = False
	M1 = -100000000000.0
	M2 = -100000000000.0
	for j in range(n):
		(d, h) = map(int, input().split())
		blow.append([d, h])
	for j in range(n):
		d = blow[j][0]
		h = blow[j][1]
		if d >= x:
			res *= -1
			f = False
			break
		if d > h:
			f = True
		M1 = max(M1, d)
		M2 = max(M2, d - h)
	if f == False:
		print(res)
	else:
		print(ceil((x - M1) / M2) + 1)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	(n, k) = mp()
	ml = [tuple(mp()) for i in range(n)]
	mx = 0
	for i in ml:
		mx = max(mx, i[0])
	ml.sort(key=lambda x: x[0] - x[1])
	t = ml[-1][0] - ml[-1][1]
	if k <= mx:
		print(1)
	elif t <= 0:
		print(-1)
	else:
		print(1 + ceil(max(0, k - mx), t))


import math
t = int(input())
for i in range(t):
	(n, x) = [int(i) for i in input().split()]
	diff = []
	damage = []
	for j in range(n):
		(d, h) = [int(i) for i in input().split()]
		diff.append(d - h)
		damage.append(d)
	max_damage = max(diff)
	max_fatal_damage = max(damage)
	if max_damage <= 0:
		if max_fatal_damage >= x:
			print(1)
		else:
			print(-1)
	else:
		n_max_damages = max(math.ceil((x - max_fatal_damage) / max_damage), 0)
		final_x = x - n_max_damages * max_damage
		if final_x > 0:
			print(n_max_damages + 1)
		else:
			print(n_max_damages)


t = int(input())
for i in range(t):
	(n, x) = [int(j) for j in input().split()]
	(diff, best_strike) = (None, None)
	for j in range(n):
		(strike, heads) = [int(i) for i in input().split()]
		if best_strike is None or strike > best_strike:
			best_strike = strike
		if strike > heads and (diff is None or diff < strike - heads):
			diff = strike - heads
	x -= best_strike
	if x <= 0:
		print(1)
	elif diff is None:
		print(-1)
	else:
		print(1 + x // diff + int(x % diff > 0))


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	DH = []
	R = []
	for i in range(n):
		(d, h) = map(int, input().split())
		DH.append((d, h))
		R.append(d - h)
	DH.sort(reverse=True)
	R.sort(reverse=True)
	if x <= DH[0][0]:
		print(1)
	elif R[0] <= 0:
		print(-1)
	else:
		x -= DH[0][0]
		r = R[0]
		ans = 1 + (x + r - 1) // r
		print(ans)


import math
n = int(input())
for j in range(n):
	(n1, h) = map(int, input().split())
	a = [0] * n1
	b = [0] * n1
	for i in range(n1):
		(a[i], b[i]) = map(int, input().split())
		b[i] = a[i] - b[i]
	a.sort(reverse=True)
	b.sort(reverse=True)
	if b[0] <= 0 and h > a[0]:
		print(-1)
	else:
		c = max(0, h - a[0])
		if c == 0:
			print(1)
		else:
			c = math.ceil(c / b[0])
			print(c + 1)


import math

def moves(arr, brr, x):
	ans = -1
	d = max(arr)
	li = []
	maxx = 0
	for i in range(len(brr)):
		li.append(arr[i] - brr[i])
		if arr[i] - brr[i] > maxx:
			maxx = arr[i] - brr[i]
	if x <= d:
		ans = 1
	elif maxx > 0:
		ans = 1 + math.ceil((x - d) / maxx)
	return ans
t = int(input())
ans = []
while t > 0:
	a = input().split()
	x = int(a[1])
	arr = []
	brr = []
	for i in range(int(a[0])):
		line = input().split()
		arr.append(int(line[0]))
		brr.append(int(line[1]))
	ans.append(moves(arr, brr, x))
	t = t - 1
for an in ans:
	print(an)


from math import ceil
for t in range(int(input())):
	a = []
	(n, x) = list(map(int, input().split()))
	for i in range(n):
		a.append(list(map(int, input().split())))
	max_di = a[0][0]
	max_damage = a[0][0] - a[0][1]
	for i in a:
		if i[0] > max_di:
			max_di = i[0]
		if i[0] - i[1] > max_damage:
			max_damage = i[0] - i[1]
	x -= max_di
	if x > 0:
		if max_damage <= 0:
			print(-1)
		else:
			print(ceil(x / max_damage) + 1)
	else:
		print(1)


t = int(input())
for _ in range(t):
	l = list(map(int, input().strip().split()))
	n = l[0]
	x = l[1]
	c = 0
	res = 0
	a = []
	mxd = 0
	mx = 0
	for _ in range(n):
		l = list(map(int, input().strip().split()))
		d = l[0]
		h = l[1]
		mxd = max(mxd, d - h)
		mx = max(mx, d)
	if x <= mx:
		print(1)
	elif mxd == 0:
		print(-1)
	else:
		diff = x - mx
		if diff % mxd == 0:
			print(diff // mxd + 1)
		else:
			print(diff // mxd + 2)


import math
t = int(input())
for w in range(t):
	(n, x) = (int(i) for i in input().split())
	diff = []
	d = []
	h = []
	c = 0
	for i in range(n):
		(di, hi) = (int(i) for i in input().split())
		if di <= hi:
			c += 1
		d.append(di)
		h.append(hi)
		diff.append(di - hi)
	m = diff[0]
	m1 = d[0]
	m2 = h[0]
	for i in range(n):
		m = max(diff[i], m)
		if m == diff[i]:
			m1 = d[i]
			m2 = h[i]
	m3 = max(d)
	if c == n:
		if m3 >= x:
			print(1)
		else:
			print(-1)
	else:
		k = max(0, math.ceil((x - m3) / m))
		print(max(1, k + 1))


import math
t = int(input())
for test in range(t):
	(n, x) = [int(x) for x in input().split()]
	maxb = 0
	maxd = 0
	for i in range(n):
		(b, c) = [int(x) for x in input().split()]
		if b - c > maxd:
			maxd = b - c
		if b > maxb:
			maxb = b
	if x <= maxb:
		print(1)
		continue
	if maxd == 0:
		print(-1)
		continue
	req = x - maxb
	op = math.ceil(req / maxd)
	print(op + 1)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	ls = []
	md = -1000000000.0
	maxc = 0
	for j in range(n):
		ls.append(tuple(map(int, input().split())))
		maxc = max(maxc, ls[-1][0])
		md = max(md, ls[-1][0] - ls[-1][1])
	steps = -1
	if x > maxc and md <= 0:
		print(-1)
	elif x > maxc:
		d = x - maxc
		import math
		z = math.ceil(d / md)
		if z * md == x:
			print(z)
		else:
			print(z + 1)
	else:
		print(1)


T = int(input())
for _ in range(T):
	(n, x) = map(int, input().split())
	blows = [[int(_) for _ in input().split()] for _ in range(n)]
	a = max((_[0] for _ in blows))
	b = max((_[0] - _[1] for _ in blows))
	if x <= a:
		print(1)
	elif b <= 0:
		print(-1)
	else:
		(c, d) = divmod(x - a, b)
		print(c + (d > 0) + 1)


t = int(input())
k = -1000000000
for i in range(t):
	(n, x) = map(int, input().split())
	k = -1
	p = 10000000000000000
	for j in range(n):
		(d, h) = map(int, input().split())
		k = max(k, d)
		p = min(p, h - d)
	if k >= x:
		print(1)
	elif p >= 0:
		print(-1)
	else:
		print((x - k - 1) // -p + 2)


from math import ceil

def solve(x, step, d):
	if x <= d:
		return 1
	if step <= 0:
		return -1
	t = int(ceil((x - d) / step))
	return t if x - step * t <= 0 else t + 1

def main():
	from sys import stdin
	T = int(stdin.readline().strip())
	for _ in range(T):
		(n, x) = list(map(int, stdin.readline().strip().split()))
		step = mx_d = -10 ** 9
		for _ in range(n):
			(d, h) = list(map(int, stdin.readline().strip().split()))
			if d - h > step:
				step = d - h
			if d > mx_d:
				mx_d = d
		print(solve(x, step, mx_d))
main()


for _ in range(int(input())):
	(n, x) = (*map(int, input().split()),)
	inp = [[int(x) for x in input().split()] for _ in range(n)]
	dlt = [a[1] - a[0] for a in inp]
	bs = max(map(lambda x: x[0], inp))
	x -= bs
	if x <= 0:
		print(1)
		continue
	mnD = min(dlt)
	if mnD >= 0:
		print(-1)
		continue
	mnD *= -1
	print(1 + (x + mnD - 1) // mnD)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	k = 0
	d = 0
	for _ in range(n):
		(a, b) = map(int, input().split())
		k = max(k, a)
		d = max(a - b, d)
	if d == 0:
		if k >= x:
			print(1)
			continue
		print(-1)
		continue
	x = max(x - k, 0)
	c = x // d + 1
	if x // d * d != x:
		c += 1
	print(c)


import math
d = []
t = int(input())
while t > 0:
	t -= 1
	(n, x) = map(int, input().split(' '))
	n = int(n)
	x = int(x)
	m1 = 10000000000.0
	m2 = -1
	for i in range(n):
		(inp0, inp1) = map(int, input().split(' '))
		m1 = min(m1, x - inp0)
		m2 = max(m2, inp0 - inp1)
	if m2 != 0:
		ans = 1 + math.ceil(m1 / m2)
	if m2 <= 0:
		ans = -1
	if m1 <= 0:
		ans = 1
	print(ans)


import math
for _ in range(int(input())):
	(blows_count, heads) = [int(x) for x in input().split()]
	blows = []
	for _ in range(blows_count):
		blows.append([int(x) for x in input().split()])
	max_cut = max([t[0] for t in blows])
	max_delta = max([t[0] - t[1] for t in blows])
	if max_cut < heads and max_delta <= 0:
		print(-1)
		continue
	if max_cut >= heads:
		print(1)
		continue
	iterative_cuts = max(math.ceil((heads - max_cut) / max_delta), 0)
	print(iterative_cuts + 1)


N = int(input())
for i in range(N):
	(n, x) = list(map(int, input().split()))
	d_max = 0
	d_h = 0
	for i in range(n):
		(d, h) = list(map(int, input().split()))
		if d > d_max:
			d_max = d
		if d - h > d_h:
			d_h = d - h
	if d_max < x and d_h == 0:
		print(-1)
	elif d_max >= x:
		print(1)
	elif (x - d_max) % d_h > 0:
		print((x - d_max) // d_h + 2)
	else:
		print((x - d_max) // d_h + 1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = [list(map(int, input().split())) for _ in range(n)]
	(max1, max2) = (-float('inf'), -float('inf'))
	for q in a:
		max1 = max(q[0], max1)
		max2 = max(max2, q[0] - q[1])
	if max1 >= x:
		print(1)
	elif max2 <= 0:
		print(-1)
	else:
		print((x - max1 + max2 - 1) // max2 + 1)


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	maxDH = -10 ** 9
	arr = []
	for i in range(n):
		(a, b) = map(int, input().split())
		maxDH = max(maxDH, a - b)
		arr.append([a, b])
	res = 1
	maxD = -1
	for i in arr:
		maxD = max(maxD, i[0])
	m -= maxD
	if m > 0:
		if maxDH <= 0:
			res = -1
		else:
			res += (m + maxDH - 1) // maxDH
	print(res)


import math
t = int(input())
for test in range(t):
	(n, x) = map(int, input().split())
	mxd = 0
	mxe = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		mxd = max(mxd, d - h)
		mxe = max(mxe, d)
	x -= mxe
	if x <= 0:
		print(1)
		continue
	if mxd == 0:
		print(-1)
		continue
	print(math.ceil((x + mxd) / mxd))


import math
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	maxdh = -2000000000.0
	maxd = -2000000000.0
	for _ in range(n):
		(d, h) = map(int, input().split())
		maxd = max(maxd, d)
		maxdh = max(maxdh, d - h)
	r = 1
	if x <= maxd:
		print(r)
	elif maxdh <= 0:
		print(-1)
	else:
		print(math.ceil((x - maxd) / maxdh) + 1)


t = int(input())
import math
for _ in range(t):
	(n, x) = list(map(int, input().split()))
	(l, k) = (float('-inf'), float('-inf'))
	for i in range(n):
		p = list(map(int, input().split()))
		if p[0] > l:
			l = p[0]
		if p[0] - p[1] > k:
			k = p[0] - p[1]
	if k <= 0:
		if l >= x:
			print(1)
		else:
			print(-1)
	elif x <= l:
		print(1)
	else:
		print(math.ceil((x - l) / k) + 1)


import math
for q in range(int(input())):
	(n, x) = map(int, input().split())
	A = []
	m = 0
	for N in range(n):
		(d, h) = map(int, input().split())
		A.append(d)
		m = max(d - h, m)
	M = max(A)
	if M >= x:
		print(1)
	elif m <= 0:
		print(-1)
	else:
		print(max(1, math.ceil((x - M) / m) + 1))


import math
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	max_damage_hit = -1
	max_damage_per_round_hit = -1
	for __ in range(n):
		(di, hi) = map(int, input().split())
		max_damage_hit = max(di, max_damage_hit)
		max_damage_per_round_hit = max(di - hi, max_damage_per_round_hit)
	if max_damage_per_round_hit <= 0:
		print(1 if max_damage_hit >= x else -1)
		continue
	hits = max(math.ceil((x - max_damage_hit) / max_damage_per_round_hit), 0) + 1
	print(hits)


from math import ceil

def main():
	c = int(input())
	for i in range(c):
		(n, m) = [int(v) for v in input().split()]
		data = []
		for j in range(n):
			(a, b) = [int(v) for v in input().split()]
			data.append((a, b))
		min_v = min([m - d[0] for d in data])
		if min_v <= 0:
			print(1)
			continue
		diffs = max([d[0] - d[1] for d in data])
		if diffs <= 0:
			print(-1)
		else:
			print(ceil(min_v / diffs) + 1)
main()


for T_T in range(int(input())):
	(n, x) = map(int, input().strip().split())
	maxAtk = 0
	maxRes = 0
	for i in range(n):
		(atk, grow) = map(int, input().strip().split())
		maxAtk = max(maxAtk, atk)
		maxRes = max(maxRes, atk - grow)
	if maxAtk >= x:
		print(1)
	elif maxRes == 0:
		print(-1)
	else:
		print(1 + (x - maxAtk + maxRes - 1) // maxRes)


t = int(input())
while t > 0:
	t -= 1
	inp = input().split()
	n = int(inp[0])
	CurX = int(inp[1])
	ma1 = 0
	ma2 = 0
	for i in range(n):
		inp = input().split()
		d = int(inp[0])
		h = int(inp[1])
		ma1 = max(ma1, d)
		ma2 = max(ma2, d - h)
	if CurX <= ma1:
		print(1)
	elif ma2 == 0:
		print(-1)
	else:
		ans = int((CurX + ma2 - ma1 - 1) / ma2 + 1)
		print(ans)


from sys import stdin
from sys import setrecursionlimit as SRL
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda : map(int, rd().strip().split())
T = int(input())
while T:
	(n, x) = rrd()
	tot1 = 0
	tot2 = 0
	for i in range(n):
		(a, b) = rrd()
		a -= b
		tot1 = max(tot1, a)
		tot2 = max(tot2, a + b)
	x -= tot2
	if x <= 0:
		print(1)
		T -= 1
		continue
	if tot1 == 0:
		print(-1)
	else:
		print(x // tot1 + (x % tot1 != 0) + 1)
	T -= 1


from math import ceil
q = int(input())
for j in range(q):
	(n, x) = map(int, input().split())
	m = 0
	mm = 0
	p = False
	for i in range(n):
		(d, h) = map(int, input().split())
		m = max(d, m)
		mm = max(mm, d - h)
		p = p or d > h
	if not p and m < x:
		print(-1)
	elif m >= x:
		print(1)
	else:
		print(1 + ceil((x - m) / mm))


for q in range(int(input())):
	(n, x) = map(int, input().split())
	ans = 0
	aria = 0
	AJ = 0
	for i in range(0, n):
		(d, h) = map(int, input().split())
		if d - h > 0:
			ans = 1
		aria = max(aria, d)
		AJ = max(AJ, d - h)
	if aria >= x:
		print(1)
		continue
	if ans == 0:
		print(-1)
	else:
		print((x - aria) // AJ + 1 + ((x - aria) % AJ != 0))


from math import ceil
for t in range(int(input())):
	(n, x) = [int(j) for j in input().split()]
	d_max = -1 * 1000000000000.0
	d_h = -1 * 1000000000000.0
	for i in range(n):
		(d, h) = [int(j) for j in input().split()]
		d_max = max(d, d_max)
		d_h = max(d_h, d - h)
	if d_h <= 0 and x > d_max:
		print(-1)
	elif x <= d_max:
		print(1)
	else:
		print(ceil((x - d_max) / d_h) + 1)


import math
total_count = int(input())
answer = []
while total_count > 0:
	(n, x) = map(int, input().split())
	diff = 0
	dmax = 0
	temp = 0
	while n > 0:
		(d, h) = map(int, input().split())
		dmax = max(dmax, d)
		diff = max(diff, d - h)
		n = n - 1
	if diff != 0:
		temp = (x - dmax + diff - 1) / diff + 1
		temp = int(temp)
	if diff == 0:
		temp = -1
	if x - dmax <= 0:
		temp = 1
	answer.append(temp)
	total_count = total_count - 1
for element in answer:
	print(element)


T = int(input())
while T > 0:
	T -= 1
	(n, head) = map(int, input().split())
	possible = False
	eff = 0
	maxDmg = 0
	for i in range(n):
		(kill, respawn) = map(int, input().split())
		if kill > respawn:
			possible = True
		eff = max(eff, kill - respawn)
		maxDmg = max(maxDmg, kill)
	if maxDmg >= head:
		print(1)
	elif not possible:
		print(-1)
	else:
		print((head - maxDmg) // eff + (1 if (head - maxDmg) % eff else 0) + 1)


def readint():
	return map(int, input().split())
(t,) = readint()
for _ in range(t):
	(n, x) = readint()
	mnnet = 10 ** 9
	mxdmg = 0
	for _ in range(n):
		(d, h) = readint()
		net = h - d
		mnnet = min(mnnet, net)
		mxdmg = max(mxdmg, d)
	if mxdmg >= x:
		ans = 1
	elif mnnet < 0:
		ans = 1 + max(0, (x - mxdmg - 1) // -mnnet + 1)
	else:
		ans = -1
	print(ans)


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	d = [list(map(int, input().split())) for a in range(n)]
	max_kick = 0
	max_damage = 0
	for i in range(n):
		if d[i][0] > max_kick:
			max_kick = d[i][0]
		if d[i][0] - d[i][1] > max_damage:
			max_damage = d[i][0] - d[i][1]
	if max_kick >= x:
		print(1)
		continue
	else:
		if max_kick == 0 or (max_kick != 0 and max_damage == 0) or max_kick + max_damage == 0:
			print(-1)
			continue
		kicks_to_win = (x - max_kick) // max_damage if (x - max_kick) % max_damage == 0 and x - max_kick >= max_damage else (x - max_kick) // max_damage + 1
		print(kicks_to_win + 1)


t = int(input())
for _ in range(t):
	(n, x) = (int(_) for _ in input().split())
	mx = 0
	mx_profit = 0
	for _ in range(n):
		(d, h) = (int(_) for _ in input().split())
		if d > mx:
			mx = d
		cur_profit = d - h
		if cur_profit > mx_profit:
			mx_profit = cur_profit
	if mx < x and mx_profit < 1:
		result = -1
	else:
		r = x - mx
		if r < 1:
			result = 1
		else:
			result = r // mx_profit + (r % mx_profit != 0) + 1
	print(result)


import sys
import math
from operator import itemgetter
ntc = int(sys.stdin.readline().rstrip())
for tcs in range(ntc):
	(n, x) = list(map(int, sys.stdin.readline().rstrip().split()))
	d = list()
	finalattack = 0
	iscomplete = False
	for i in range(n):
		inp = list(map(int, sys.stdin.readline().rstrip().split()))
		inp.append(inp[0] - inp[1])
		if inp[2] > 0:
			iscomplete = True
		finalattack = max(finalattack, inp[0])
		d.append(inp)
	if x - finalattack <= 0:
		print(1)
		continue
	if iscomplete == False:
		print(-1)
	else:
		d.sort(reverse=True, key=itemgetter(2))
		x -= finalattack
		print(math.ceil(x / d[0][2]) + 1)


import sys

def main():
	t = int(sys.stdin.readline().strip())
	for _ in range(t):
		(n, x) = [int(x) for x in sys.stdin.readline().strip().split()]
		best = 0
		last = 0
		for i in range(n):
			(d, h) = [int(x) for x in sys.stdin.readline().strip().split()]
			best = max(best, d - h)
			last = max(last, d)
		last = max(last, best)
		if best == 0:
			if x > last:
				print(-1)
			else:
				print(1)
			continue
		print(1 + (max(0, x - last) + best - 1) // best)
main()


from math import ceil
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	Max = -10000000000
	max_d = -100000000000
	(gd, gh) = (-1, -1)
	for i in range(n):
		(d, h) = map(int, input().split())
		if d - h > Max:
			Max = d - h
			gd = d
			gh = h
		max_d = max(d, max_d)
	if Max <= 0:
		if max_d >= x:
			print(1)
		else:
			print(-1)
	elif max_d >= x:
		print(1)
	else:
		ans = ceil((x - max_d) / Max)
		print(ans + 1)


import math

def main():
	t = int(input())
	for _ in range(t):
		(n, x) = [int(s) for s in input().split()]
		blows = [[int(s) for s in input().split()] for _ in range(n)]
		max_d = max((d for (d, _) in blows))
		max_diff = max((d - h for (d, h) in blows))
		if max_d >= x:
			print(1)
			continue
		if max_diff <= 0:
			print(-1)
			continue
		x -= max_d
		if x % max_diff == 0:
			print(x // max_diff + 1)
		else:
			print(x // max_diff + 2)
main()


def main():
	(n, x) = map(int, input().split())
	(d, h) = (-1, -1)
	temp = 0
	maxd = 0
	for _ in range(n):
		(a, b) = map(int, input().split())
		if a - b > 0 and a - b > temp:
			d = a
			h = b
			temp = a - b
		if a > maxd:
			maxd = a
	if x <= maxd:
		print(1)
	elif temp <= 0:
		print(-1)
	else:
		print((x - maxd + temp - 1) // temp + 1)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


import math
for x in range(int(input())):
	(n, x) = list(map(int, input().split()))
	d = 10 ** 9
	s = 0
	h = 0
	for i in range(n):
		(a, m) = list(map(int, input().split()))
		h = max(a, h)
		if a > m:
			s = max(s, a - m)
	if s > 0 or x - h <= 0:
		if x - h <= 0:
			print(1)
		else:
			k = math.ceil((x - h) / s)
			print(k + 1)
	else:
		print(-1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	c = 0
	d = 0
	for __ in range(n):
		(a, b) = map(int, input().split())
		d = max(d, a - b)
		c = max(c, a)
	x -= c
	ans = 1
	if x > 0 and d <= 0:
		print(-1)
	elif x > 0:
		if x % d == 0:
			ans += x // d
		else:
			ans += x // d + 1
		print(ans)
	else:
		print(ans)


T = int(input())
for _ in range(0, T):
	(n, x) = map(int, input().split())
	L = []
	dp = []
	for i in range(n):
		(d, h) = map(int, input().split())
		L.append((d, h))
		dp.append(h - d)
	h = max(L)
	if x - h[0] <= 0:
		print(1)
	else:
		x = x - h[0]
		t = min(dp)
		if t >= 0 and x > 0:
			print(-1)
		else:
			t = abs(t)
			ans = x // t
			if x % t != 0:
				ans += 1
			print(ans + 1)


T = int(input())
for _ in range(T):
	(n, x) = map(int, input().split())
	bestBlow = -1
	iBlow = -1
	for i in range(n):
		(d, h) = map(int, input().split())
		bestBlow = max(bestBlow, d - h)
		iBlow = max(iBlow, d)
	if bestBlow <= 0:
		print(1) if iBlow >= x else print(-1)
	else:
		print((max(0, x - iBlow) + bestBlow - 1) // bestBlow + 1)


ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
for _ in range(ii()):
	(n, x) = kk()
	maxd = maxi = 0
	for _ in range(n):
		(a, b) = kk()
		if a > maxi:
			maxi = a
		if a - b > maxd:
			maxd = a - b
	x -= maxi
	if x <= 0:
		print(1)
	elif maxd == 0:
		print(-1)
	else:
		print(1 + x // maxd + min(1, x % maxd))


from math import *
qtos_casos = int(input())
for x in range(qtos_casos):
	(qtos_golpes, qtas_cabecas) = input().split()
	qtos_golpes = int(qtos_golpes)
	qtas_cabecas = int(qtas_cabecas)
	tiramais = -1
	matamais = -1
	for z in range(qtos_golpes):
		(tira, bota) = input().split()
		tira = int(tira)
		bota = int(bota)
		dif = tira - bota
		tiramais = max(tiramais, dif)
		matamais = max(matamais, tira)
	if matamais >= qtas_cabecas:
		print(1)
	elif tiramais <= 0:
		print(-1)
	else:
		devdd = qtas_cabecas - matamais
		resp = ceil(devdd / tiramais)
		print(resp + 1)


from math import ceil
t = int(input())
ans = []
for _ in range(t):
	(n, x) = map(int, input().split())
	a = -1
	b = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		a = max(a, d - h)
		b = max(b, d)
	if x <= b:
		ans.append(1)
		continue
	elif a <= 0:
		ans.append(-1)
	else:
		x = x - b
		ans.append(ceil(x / a) + 1)
for el in ans:
	print(el)


def main():
	t = int(input())
	for _ in range(t):
		(n, x) = map(int, input().split())
		d = []
		h = []
		for i in range(n):
			(dd, hh) = map(int, input().split())
			d.append(dd)
			h.append(hh)
		k = max(d)
		kk = max([d[i] - h[i] for i in range(n)])
		if k >= x:
			print(1)
		elif kk <= 0:
			print(-1)
		else:
			print((x - k + kk - 1) // kk + 1)
	return
main()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	(change, final) = (0, 0)
	for _ in range(n):
		(d, h) = map(int, input().split())
		change = max([change, d - h])
		final = max([final, d])
	if change == 0 and final < x:
		print(-1)
		continue
	elif change == 0:
		print(1)
		continue
	print((max([0, x - final]) + change - 1) // change + 1)


t = int(input())
for i in range(t):
	(n, x) = (int(j) for j in input().split())
	max1 = 0
	max2 = 0
	for j in range(n):
		(d, h) = (int(f) for f in input().split())
		max1 = max(d, max1)
		max2 = max(d - h, max2)
	if max1 >= x:
		k = 1
	elif max2 == 0:
		k = -1
	else:
		hp = x - max1
		k = 1 + hp // max2
		k += 1 if max2 * (hp // max2) < hp else 0
	print(k)


import math
t = int(input())
for i in range(t):
	head = tuple(map(int, input().split()))
	(n, curX) = (head[0], head[1])
	(max_power, max_d) = (0, 0)
	for j in range(n):
		(d, h) = tuple(map(int, input().split()))
		max_power = d - h if max_power < d - h else max_power
		max_d = d if d > max_d else max_d
	curX = curX - max_d
	if max_power <= 0 and curX > 0:
		print(-1)
	elif curX <= 0:
		print(1)
	else:
		print(math.ceil(curX / max_power) + 1)


def main():
	t = int(input())
	allans = []
	for _ in range(t):
		(n, x) = readIntArr()
		d = []
		h = []
		for _ in range(n):
			(dd, hh) = readIntArr()
			d.append(dd)
			h.append(hh)
		maxDamage = max(d)
		if x - maxDamage <= 0:
			allans.append(1)
			continue
		maxDiff = -inf
		for i in range(n):
			maxDiff = max(maxDiff, d[i] - h[i])
		if maxDiff <= 0:
			allans.append(-1)
			continue
		ans = 1 + (x - maxDamage + maxDiff - 1) // maxDiff
		allans.append(ans)
	multiLineArrayPrint(allans)
	return
import sys
input = sys.stdin.buffer.readline

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()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(i, j):
	print('? {} {}'.format(i, j))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(' '.join([str(x) for x in ans])))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	defeat = False
	md = -1
	dec = -1
	for i in range(n):
		(d, h) = map(int, input().split())
		md = d if md == -1 else max(d, md)
		if d > h or d >= x:
			defeat = True
		if d > h:
			dec = d - h if dec == -1 else max(dec, d - h)
	if not defeat:
		print(-1)
		continue
	if md >= x:
		print(1)
		continue
	cur = x
	from math import ceil
	ans = ceil((cur - md) / dec)
	cur -= ans * dec
	print(ans if cur <= 0 else ans + 1)


from math import ceil
cases = int(input())
for _ in range(cases):
	(blows, heads) = [int(i) for i in input().split()]
	res = []
	for i in range(blows):
		res.append([int(i) for i in input().split()])
	n_b = max((i[0] - i[1] for i in res))
	final = max((i[0] for i in res))
	if final >= heads:
		print(1)
	elif n_b <= 0:
		print(-1)
	else:
		print(ceil((heads - final) / n_b + 1))


t = int(input())
for _ in range(0, t):
	(n, x) = map(int, input().split())
	maxx = 0
	diff = 0
	for i in range(0, n):
		(d, h) = map(int, input().split())
		maxx = max(maxx, d)
		diff = max(diff, d - h)
	if x <= maxx:
		print(1)
	elif diff > 0:
		modd = x % diff
		ans = x // diff
		ans = ans - (maxx - modd) // diff + 1
		print(ans)
	else:
		print(-1)


T = int(input())
for tc in range(T):
	(n, x) = map(int, input().split())
	max_deal = 0
	max_d = 0
	for t in range(n):
		(d, h) = map(int, input().split())
		if max_deal < d - h:
			max_deal = d - h
			max_deal_d = d
		if max_d < d:
			max_d = d
	if max_d >= x:
		print(1)
		continue
	elif max_deal <= 0:
		print(-1)
		continue
	if (x - max_d) % max_deal == 0:
		print((x - max_d) // max_deal + 1)
	else:
		print((x - max_d) // max_deal + 2)


import sys, math
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(n, x) = (int(x) for x in input().split())
	dh = [list(map(int, input().split())) for _ in range(n)]
	maxdam = max(dh)[0]
	maxdiff = max([x[0] - x[1] for x in dh])
	if maxdam >= x:
		print('1')
	elif maxdiff <= 0:
		print('-1')
	else:
		print(math.ceil((x - maxdam) / maxdiff) + 1)


import math
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	maxdamage = 0
	maxprofit = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		profit = d - h
		maxprofit = max(maxprofit, profit)
		maxdamage = max(d, maxdamage)
	if maxdamage >= x:
		print(1)
	elif maxprofit == 0:
		print(-1)
	else:
		print(math.ceil((x - maxdamage) / maxprofit) + 1)


t = int(input())
for _ in range(t):
	(n, xx) = map(int, input().split())
	it = []
	for __ in range(n):
		it.append(list(map(int, input().split())))
	x = max(it, key=lambda a: a[0] - a[1])
	r = x[0] - x[1]
	if r <= 0:
		if max(it)[0] >= xx:
			print(1)
		else:
			print(-1)
		continue
	aa = max(it)[0]
	xx = max(0, xx - aa)
	tot = xx / r
	if tot % 1 != 0:
		tot = int(tot) + 1
	else:
		tot = int(tot)
	print(tot + 1)


import math
T = int(input())
for _ in range(T):
	(n, x) = map(int, input().strip().split())
	best_blow = (-1, -1)
	max_d = -1
	for _ in range(n):
		(d, h) = map(int, input().strip().split())
		max_d = max(max_d, d)
		if h >= d:
			continue
		diff = d - h
		if diff > best_blow[0] - best_blow[1]:
			best_blow = (d, h)
	if max_d >= x:
		print(1)
	elif best_blow == (-1, -1):
		print(-1)
	else:
		diff = best_blow[0] - best_blow[1]
		blows = math.ceil((x - max_d) / diff) + 1
		print(blows)


t = int(input())
for i in range(t):
	(n, x) = (int(i) for i in input().split())
	mr = 0
	md = 0
	for j in range(n):
		(d, h) = (int(i) for i in input().split())
		md = max(d, md)
		mr = max(d - h, mr)
	x -= md
	if not mr and x > 0:
		print(-1)
	elif x <= 0:
		print(1)
	else:
		f = x // mr + 1
		if x % mr:
			f += 1
		print(f)


en = int(input())
for i in range(en):
	en1 = list(map(int, input().split()))
	(tipos, cabecas) = (en1[0], en1[1])
	maior = 0
	(m1, m2) = (0, 0)
	for i in range(tipos):
		en2 = list(map(int, input().split()))
		(m, b) = (en2[0], en2[1])
		m1 = max(m1, m)
		m2 = max(m2, m - b)
	if m1 < cabecas and m2 == 0:
		print(-1)
	elif m1 >= cabecas:
		print(1)
	else:
		print(int(1 + (cabecas - m1 + m2 - 1) / m2))


t = int(input())
while t:
	(n, x) = map(int, input().split())
	a = []
	b = []
	for i in range(n):
		(d, h) = map(int, input().split())
		a.append(d - h)
		b.append(d)
	a.sort()
	b.sort()
	if b[n - 1] >= x:
		print(1)
	elif a[n - 1] > 0:
		if (x - b[n - 1]) % a[n - 1] == 0 and x - b[n - 1] >= 0:
			print((x - b[n - 1]) // a[n - 1] + 1)
		elif (x - b[n - 1]) % a[n - 1] != 0 and x - b[n - 1] >= 0:
			print((x - b[n - 1]) // a[n - 1] + 1 + 1)
		elif (x - b[n - 1]) % a[n - 1] == 0:
			print(1)
		else:
			print(2)
	else:
		print(-1)
	t -= 1


import math

def f(x):
	return x[0] - x[1]
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	diff = []
	mx = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		if d > mx:
			mx = d
		diff.append([d, h])
	diff.sort(key=f)
	x -= mx
	df = diff[-1][0] - diff[-1][1]
	if x <= 0:
		print(1)
	elif df <= 0:
		print(-1)
	else:
		ans = math.ceil(x / df)
		print(ans + 1)


import math
t = int(input())
for _ in range(t):
	(n, x) = list(map(int, input().split()))
	(max_d, max_dh) = (-100, -100)
	for t1 in range(n):
		(d, h) = list(map(int, input().split()))
		max_d = max(max_d, d)
		max_dh = max(max_dh, d - h)
	if x <= max_d:
		print(1)
		continue
	if max_dh <= 0:
		print(-1)
		continue
	ans = math.ceil((x - max_d) / max_dh)
	if ans < 0:
		ans = 0
	print(ans + 1)


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

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
for _ in range(ri(1)):
	(n, curr) = ri()
	a = []
	for i in range(n):
		a.append(ri())
	a.sort(key=lambda x: -x[0] + x[1])
	hey = a[0][0] - a[0][1]
	take = -1
	b = []
	for (i, j) in a:
		take = max(take, i)
		b.append(i - j)
	b.sort(reverse=True)
	ans = 0
	curr = curr - take
	if curr <= 0:
		print(1)
	elif b[0] <= 0:
		print(-1)
	else:
		hey = curr // b[0]
		if curr % b[0] == 0:
			print(hey + 1)
		else:
			print(hey + 2)


for _ in range(0, int(input())):
	(n, x) = map(int, input().split())
	ma = 0
	opt = -10 ** 9
	for i in range(0, n):
		(d, h) = map(int, input().split())
		opt = max(opt, d - h)
		ma = max(ma, d)
	if opt <= 0:
		if ma >= x:
			print(1)
		else:
			print(-1)
	else:
		g = (x - ma) // opt
		if (x - ma) / opt <= 0:
			print(1)
		elif (x - ma) % opt != 0:
			print(2 + g)
		else:
			print(1 + g)


from sys import stdin
from math import ceil
input = stdin.readline
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	dh = [list(map(int, input().split())) for i in range(n)]
	dx = -10 ** 18
	for i in range(n):
		if dh[i][0] - dh[i][1] > dx:
			dx = dh[i][0] - dh[i][1]
	max_d = 0
	for i in range(n):
		max_d = max(max_d, dh[i][0])
	cnt = 0
	if dx <= 0 and x > max_d:
		print(-1)
	elif x <= max_d:
		print(1)
	else:
		print(1 + ceil((x - max_d) / dx))


t = int(input())
for _ in range(t):
	(n, l) = map(int, input().split())
	a = []
	m = 0
	ans = 10 ** 10
	for i in range(n):
		(x, y) = map(int, input().split())
		m = max(m, x)
		a.append([x, y])
	d = 0
	for i in range(n):
		if a[i][0] > a[i][1]:
			d = max(d, a[i][0] - a[i][1])
	if d == 0:
		if m < l:
			print(-1)
		else:
			print(1)
	else:
		l = l - m
		ans = max(l // d + bool(l % d) + 1, 1)
		print(ans)


import sys
input = lambda : sys.stdin.readline().strip()
from math import ceil
T = int(input())
for i in range(T):
	(n, x) = map(int, input().split())
	ls = []
	for i in range(n):
		(d, h) = map(int, input().split())
		ls.append((d, d - h))
	M0 = max((i[0] for i in ls))
	M1 = max((i[1] for i in ls))
	if x <= M0:
		print(1)
	elif M1 <= 0:
		print(-1)
	else:
		print(ceil((x - M0) / M1) + 1)


from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from heapq import heappush, heappop
import math
import io
import os
import math
import bisect

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

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

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

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

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

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

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

def mapin():
	return map(int, input().split())
t = int(input())
for _ in range(t):
	(n, x) = mapin()
	ans = 0
	l = []
	ma = 0
	mi = 1000000000.0
	for i in range(n):
		(d, h) = mapin()
		mi = min(mi, h - d)
		ma = max(ma, d)
	if x <= ma:
		ans = 1
	elif mi >= 0:
		ans = -1
	else:
		x -= ma
		mi = abs(mi)
		ans = 1 + math.ceil(x / mi)
	print(ans)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

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

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

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(n, x) = sp()
	arr = []
	(diff, m) = (-1, -1)
	for i in range(n):
		a = l()
		diff = max(diff, a[0] - a[1])
		m = max(m, a[0])
	if m >= x:
		out(1)
		continue
	(low, high) = (1, int(1e+18))
	answer = inf
	while low <= high:
		mid = low + high >> 1
		if diff * (mid - 1) + m >= x:
			answer = min(answer, mid)
			high = mid - 1
		else:
			low = mid + 1
	out((-1, answer)[answer != inf])


import sys
input = sys.stdin.readline
T = int(input())
for testcases in range(T):
	(n, x) = map(int, input().split())
	B = [tuple(map(int, input().split())) for i in range(n)]
	B0 = max(B, key=lambda x: x[0] - x[1])
	dam = B0[0] - B0[1]
	BMAX = max(B)[0]
	if dam <= 0 and x > BMAX:
		print(-1)
	elif BMAX >= x:
		print(1)
	else:
		print(1 + max(0, -((x - BMAX) // -dam)))


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	(d, h, t) = ([], [], [])
	for _ in range(n):
		(p, q) = map(int, input().split())
		d.append(p)
		h.append(q)
		t.append(p - q)
	if max(d) >= x:
		print(1)
		continue
	elif max(t) <= 0:
		print(-1)
		continue
	y = x - max(d) - 1
	print(y // max(t) + 2)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	(mf, m) = (-100000000000, 0)
	for _ in range(n):
		(t1, t2) = map(int, input().split())
		if t1 - t2 > mf:
			mf = t1 - t2
		if t1 > m:
			m = t1
	if mf <= 0:
		if m >= x:
			print(1)
		else:
			print(-1)
	else:
		print(1 + max(x - m, 0) // mf + (1 if max(x - m, 0) % mf != 0 else 0))


import math
t = int(input())
for i in range(t):
	(n, x) = [int(x) for x in input().split()]
	arr = -1
	counter = -10 ** 100
	for i in range(n):
		(a, b) = [int(x) for x in input().split()]
		if a - b > counter:
			counter = a - b
			h = a
		if a > arr:
			arr = a
	if arr >= x:
		print(1)
	elif counter < 0:
		print(-1)
	elif counter == 0:
		if arr >= x:
			print(1)
		else:
			print(-1)
	else:
		print(max(math.ceil((x - arr) / counter) + 1, -1))


def most_profit_blow_types(blows):
	profits = []
	for (d, h) in blows:
		profits.append(d - h)
	last_kick = max([d for (d, _) in blows])
	return (max(profits), last_kick)
t = int(input())
out_data = []
for _ in range(t):
	(n, x) = [int(i) for i in input().split()]
	blows = []
	for _ in range(n):
		(d, h) = [int(i) for i in input().split()]
		blows.append((d, h))
	(strongest_blow, last_kick) = most_profit_blow_types(blows)
	if last_kick >= x:
		out_data.append(1)
	elif strongest_blow <= 0:
		out_data.append(-1)
	elif (x - last_kick) % strongest_blow == 0:
		out_data.append((x - last_kick) // strongest_blow + 1)
	else:
		out_data.append((x - last_kick) // strongest_blow + 2)
for result in out_data:
	print(result)


import math
import sys
from collections import defaultdict
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def main():
	T = ri()
	for _ in range(T):
		(n, x) = rt()
		b = [tuple(map(int, input().split())) for _ in range(n)]
		maxDown = max((x[0] for x in b))
		maxDiff = max((x[0] - x[1] for x in b))
		if maxDown >= x:
			ans = 1
		elif maxDiff <= 0:
			ans = -1
		else:
			ans = 0
			x = max(0, x - maxDown)
			ans += 1
			slashes = x // maxDiff
			ans += slashes
			x -= slashes * maxDiff
			if x > 0:
				ans += 1
		print(ans)
main()


t = int(input())
for r in range(t):
	(n, x) = map(int, input().split())
	best_dif = []
	biggest = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		if d > biggest:
			biggest = d
		if type(best_dif) == int and d - h > best_dif:
			best_dif = d - h
		elif type(best_dif) == list:
			best_dif = d - h
	if best_dif <= 0 and biggest < x:
		print(-1)
	else:
		k = 1
		x -= biggest
		if x > 0:
			k += x // best_dif
			if x % best_dif != 0:
				k += 1
		print(k)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	q = [[*map(int, input().split())] for _ in range(n)]
	q.sort(key=lambda x: -(x[0] - x[1]))
	m = max((i[0] for i in q))
	t = q[0][0] - q[0][1]
	print(1 if m >= x else -1 if t <= 0 else max(-1, 1 + (x - m + t - 1) // t))


t = int(input())
for nt in range(1, t + 1):
	(n, x) = map(int, input().split())
	mxx = -1
	mxd = -1
	for i in range(n):
		(d, h) = map(int, input().split())
		mxx = max(mxx, d)
		mxd = max(mxd, d - h)
	if mxx >= x:
		print(1)
	elif mxd <= 0:
		print(-1)
	else:
		print((x - mxx + mxd - 1) // mxd + 1)


import math
t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	l = []
	l1 = []
	for j in range(n):
		(d, h) = list(map(int, input().split()))
		l.append(d - h)
		l1.append(d)
	l.sort()
	l1.sort()
	if l[-1] <= 0 and l1[-1] < m:
		print(-1)
	elif l1[-1] >= m:
		print(1)
	else:
		try:
			print(max(0, math.ceil((m - l1[-1]) / l[-1])) + 1)
		except ZeroDivisionError:
			print(1)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = b = -1100100100100
	for i in range(n):
		(d, h) = map(int, input().split())
		a = max(a, d - h)
		b = max(b, d)
	if x <= b:
		print(1)
	elif a <= 0:
		print(-1)
	else:
		x -= b
		print((x + a - 1) // a + 1)


import sys, math, queue, collections
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
for _ in range(int(input())):
	(d, h) = ([], [])
	(n, x) = map(int, input().split())
	removed = 0
	for i in range(n):
		(di, hi) = map(int, input().split())
		d.append(di)
		h.append(hi)
		removed = max(removed, di - hi)
	ans = 1
	x -= max(d)
	if removed == 0:
		if x <= 0:
			print(ans)
		else:
			print(-1)
	else:
		ans += max(0, math.ceil(x / removed))
		print(ans)


import operator
from math import *
t = int(input())
for y in range(t):
	(n, x) = map(int, input().split())
	l = []
	c = 0
	for z in range(n):
		(d, h) = map(int, input().split())
		if h >= d:
			c += 1
		l.append([d - h, d])
	l.sort()
	s = sorted(l, key=operator.itemgetter(1))
	d = l[-1][0]
	s1 = s[-1][1]
	if s1 >= x:
		print('1')
	elif c == n:
		print('-1')
	else:
		count = (x - s1) // d
		if (x - s1) % d != 0:
			count += 1
		print(count + 1)


import math
inf = 10 ** 12
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ma = -1
	di = -inf
	for i in range(n):
		(x, y) = map(int, input().split())
		di = max(di, x - y)
		ma = max(ma, x)
	if k <= ma:
		print(1)
	elif di <= 0:
		print(-1)
	else:
		print(math.ceil((k - ma) / di) + 1)


from math import *
for i in range(int(input())):
	(n, x) = list(map(int, input().split()))
	e = 0
	s = 0
	for j in range(n):
		(d, h) = list(map(int, input().split()))
		if d > s:
			s = d
		if d - h > e:
			e = d - h
	if e == 0:
		if s < x:
			print(-1)
		else:
			print(1)
	else:
		print(max(ceil((x - s) / e), 0) + 1)


t = int(input())
for _ in [0] * t:
	(n, heads) = map(int, input().split())
	attacks = [list(map(int, input().split())) for _ in range(n)]
	max_damage = max(attacks)[0]
	turn_damage = max((x - y for (x, y) in attacks))
	if heads > max_damage and turn_damage <= 0:
		print(-1)
		continue
	if heads <= max_damage:
		print(1)
		continue
	x = heads - max_damage
	print((x + turn_damage - 1) // turn_damage + 1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	bestAttack = 0
	bestDown = 0
	for _ in range(n):
		(d, h) = map(int, input().split())
		diff = d - h
		bestAttack = max(bestAttack, diff)
		bestDown = max(bestDown, d)
	x -= bestDown
	if x <= 0:
		print(1)
	elif bestAttack <= 0:
		print(-1)
	else:
		print((x + bestAttack - 1) // bestAttack + 1)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	mx = 0
	rz = 0
	for i2 in range(n):
		(a, b) = map(int, input().split())
		if a - b > rz:
			rz = a - b
		if a > mx:
			mx = a
	if x > mx and rz < 1:
		print(-1)
	else:
		out = 1
		x -= mx
		if x > 0:
			out += (x + rz - 1) // rz
		print(out)


def main():
	import sys
	input = sys.stdin.readline
	for _ in range(int(input())):
		(N, x) = map(int, input().split())
		D = []
		H = []
		H_D = []
		for _ in range(N):
			(d, h) = map(int, input().split())
			D.append(d)
			H.append(h)
			H_D.append(d - h)
		if max(D) >= x:
			print(1)
			continue
		elif max(H_D) <= 0:
			print(-1)
			continue
		print((x - max(D) - 1) // max(H_D) + 1 + 1)
main()


import math
t = int(input())
for _ in range(t):
	(n, x) = [int(i) for i in input().split()]
	arr = []
	ma = 0
	for i in range(n):
		(d, h) = [int(i) for i in input().split()]
		ma = max(ma, d)
		arr.append([d - h, d, h])
	arr.sort(reverse=True)
	fin_ans = math.inf
	rem = x - ma
	if rem > 0:
		diff = arr[0][0]
		if diff <= 0:
			print(-1)
		else:
			ans = int(math.ceil(rem / diff))
			print(ans + 1)
	else:
		print(1)


t = int(input())
for _ in range(t):
	(n, x) = [int(i) for i in input().split()]
	s = []
	for _ in range(n):
		s.append([int(i) for i in input().split()])
	g = 0
	j = 0
	c = 0
	for (d, h) in s:
		if d - h > g:
			g = d - h
		if d > j:
			j = d
	f = x - j
	if f <= 0:
		print(1)
	else:
		c += 1
		if g == 0:
			print(-1)
		else:
			print((f + g - 1) // g + c)


import sys, time
from os import path
from collections import *
from heapq import *
from math import *

def solve(kkkk):
	(n, x) = inm()
	maxi = -1
	val = 0
	for i in range(n):
		(d, h) = inm()
		val = max(val, d)
		maxi = max(maxi, d - h)
	x -= val
	ans = -1
	if x <= 0:
		ans = 1
	elif maxi > 0:
		ans = 1 + int((x + maxi - 1) / maxi)
	out(ans)

def main():
	t = 1
	t = inp()
	for i in range(t):
		solve(i + 1)
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	localsys = 1
cin = sys.stdin.readline
cout = sys.stdout.write

def inp():
	return int(cin().strip())

def ins():
	return list(cin().strip())

def inm():
	return map(int, cin().strip().split())

def ina():
	return list(map(int, cin().strip().split()))

def out(a):
	cout(str(a) + '\n')

def outa(a):
	cout(' '.join(map(str, a)) + '\n')

def outm(a, b, c=None, d=None):
	cout(str(a) + ' ' + str(b))
	if c != None:
		cout(' ' + str(c))
	if d != None:
		cout(' ' + str(d))
	cout('\n')

def crarr(a, n):
	return [a for i in range(n)]
main()
if localsys:
	print('\n\nTime Elapsed :', time.time() - start_time, 'seconds')


import sys
from collections import deque
IS_LOCAL = False

def read_one(dtype=int):
	return dtype(input())

def read_multiple(f, dtype=int):
	return f(map(dtype, input().split()))

def swap(x, y):
	return (y, x)

def solve(a, curX):
	(max_i, max_diff) = (0, -1)
	for (i, (d, h)) in enumerate(a):
		if d >= curX:
			print(1)
			return
		if d - h > max_diff:
			max_diff = d - h
			max_i = i
	if max_diff <= 0:
		print(-1)
		return
	max_d = max([d for (d, _) in a])
	(d, h) = a[max_i]
	x = (curX - max_d - 1) // max_diff + 1
	print(x + 1)

def main():
	if not IS_LOCAL:
		T = read_one(int)
		for _ in range(T):
			(n, curX) = read_multiple(tuple)
			a = []
			for _ in range(n):
				a.append(read_multiple(tuple))
			solve(a, curX)
	else:
		T = 1
		(n, curX) = (1, 6)
		a = [[3, 1]]
		solve(a, curX)
if len(sys.argv) > 1 and sys.argv[1] == 'True':
	IS_LOCAL = True
main()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, x) = map(int, sys.stdin.readline().split())
	dif = []
	y = 0
	for i in range(n):
		(d, h) = map(int, sys.stdin.readline().split())
		y = max(y, d)
		dif.append([d - h, d, h])
	dif.sort()
	dif.reverse()
	if x <= y:
		print(1)
		continue
	if dif[0][0] <= 0:
		print(-1)
		continue
	tar = y
	if (x - tar) % dif[0][0] == 0:
		ans = (x - tar) // dif[0][0] + 1
	else:
		ans = (x - tar) // dif[0][0] + 2
	print(ans)


a = int(input())
for i in range(a):
	(n, x) = map(int, input().split())
	mdx = 0
	mx = 0
	count = 0
	for j in range(n):
		(d, h) = map(int, input().split())
		mdx = max(mdx, d - h)
		mx = max(mx, d)
	if mdx <= 0:
		if mx < x:
			print(-1)
		elif mx >= x:
			print(1)
	x = max(0, x - mx)
	if mdx != 0:
		if x % mdx != 0:
			print(x // mdx + 2)
		else:
			print(x // mdx + 1)


import sys
import math

def solve(dh, x):
	mx = max(dh)[0]
	effective = [ele[0] - ele[1] for ele in dh]
	effective.sort(reverse=True)
	most_effective = effective[0]
	if x <= mx:
		return 1
	if most_effective <= 0:
		return -1
	ans = math.ceil((x - mx) / most_effective)
	return ans + 1
t = int(sys.stdin.readline())
for _ in range(t):
	(n, x) = map(int, sys.stdin.readline().split())
	dh = [tuple(map(int, sys.stdin.readline().split())) for _ in range(n)]
	ans = solve(dh, x)
	print(ans)


import math
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	arr = [None] * n
	for i in range(n):
		arr[i] = [int(o) for o in input().split()]
	marr = max(arr)
	if marr[0] >= x:
		print('1')
	else:
		tbc = []
		for i in range(n):
			if arr[i][0] > arr[i][1]:
				tbc.append(arr[i][0] - arr[i][1])
		x = x - marr[0]
		if tbc:
			mtb = max(tbc)
			print(int(math.ceil(x / mtb) + 1))
		else:
			print('-1')


import math
T = int(input())
for _ in range(T):
	(N, X) = map(int, input().split())
	d = []
	maxi = -10 ** 30
	for i in range(N):
		(x, y) = map(int, input().split())
		d.append((x - y, x, y))
		maxi = max(maxi, x)
	d.sort()
	if d[-1][0] <= 0:
		if X <= maxi:
			print(1)
		else:
			print(-1)
	else:
		cnt = 1 + max(0, math.ceil((X - maxi) / abs(d[-1][0])))
		print(cnt)


T = int(input())
for _ in range(T):
	(n, x) = map(int, input().split())
	damage = []
	maxi = []
	for i in range(n):
		(d, h) = map(int, input().split())
		maxi.append(d)
		damage.append(d - h)
	damage.sort(reverse=True)
	maxi.sort(reverse=True)
	if damage[0] <= 0 and maxi[0] < x:
		print(-1)
	elif maxi[0] >= x:
		print(1)
	else:
		print((x - maxi[0] - 1) // damage[0] + 2)


def solve():
	(n, x) = map(int, input().split())
	(maxr, maxd) = (-1, -1)
	for _ in range(n):
		(d, h) = map(int, input().split())
		maxr = max(maxr, d - h)
		maxd = max(maxd, d)
	if x <= maxd:
		return 1
	elif maxr <= 0:
		return -1
	else:
		x -= maxd
		return (x + maxr - 1) // maxr + 1
t = int(input())
while t:
	print(solve())
	t = t - 1


T = int(input())
for i in range(0, T):
	(k, x) = (int(i) for i in input().split())
	best_diff = None
	max_strike = None
	for j in range(k):
		(strike, heads) = (int(i) for i in input().split())
		if max_strike is None or strike > max_strike:
			max_strike = strike
		if strike > heads and (best_diff is None or best_diff < strike - heads):
			best_diff = strike - heads
	x -= max_strike
	if x <= 0:
		print(1)
	elif best_diff is None:
		print(-1)
	else:
		print(1 + x // best_diff + int(x % best_diff > 0))


import math
for _ in range(int(input())):
	(n, health) = map(int, input().split())
	flag = -1
	max1 = 0
	maxblow = 0
	ans = 0
	for i in range(n):
		(blow, heads) = map(int, input().split())
		if ans == 1:
			if i == n - 1:
				break
			continue
		maxblow = max(blow, maxblow)
		if blow >= health:
			print(1)
			ans = 1
			if i == n - 1:
				break
			continue
		if blow > heads:
			flag = 1
			max1 = max(max1, blow - heads)
	else:
		if flag == -1:
			print(-1)
		else:
			x = math.ceil((health - maxblow) / max1)
			print(x + 1)


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

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

def LI():
	return list(map(int, sys.stdin.readline().split()))
t = I()
for _ in range(t):
	(n, curx) = LI()
	lst = [LI() for _ in range(n)]
	maxd = 0
	for (x, y) in lst:
		maxd = max(maxd, x)
	lst = sorted(lst, key=lambda x: x[0] - x[1], reverse=True)
	(d, h) = lst[0]
	if curx - maxd <= 0:
		print(1)
		continue
	if d - h <= 0:
		print(-1)
		continue
	curx -= maxd
	ans = math.ceil(curx / (d - h)) + 1
	print(ans)


import math
t = int(input())
for _ in range(t):
	(n, x) = (int(x) for x in input().split())
	damage = 0
	max_dec = 0
	for i in range(n):
		(dec, inc) = (int(x) for x in input().split())
		max_dec = max(max_dec, dec)
		damage = max(damage, dec - inc)
	count = 1
	x -= max_dec
	if x > 0 and damage > 0:
		count += int(math.ceil(x / damage))
		x = 0
	if x <= 0:
		print(count)
	else:
		print(-1)


def main():
	testcase = int(input())
	for test in [0] * testcase:
		(n, x) = map(int, input().split())
		a = -10 ** 10
		b = -1
		for _ in [0] * n:
			(d, h) = map(int, input().split())
			a = max(a, d - h)
			b = max(b, d)
		if x <= b:
			print(1)
		elif a <= 0:
			print(-1)
		else:
			res = 1
			x -= b
			if x % a == 0:
				res += x // a
			else:
				res += x // a + 1
			print(res)
main()


import sys
import math
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(n, x) = invr()
	boro = -1
	diff = -1
	for i in range(n):
		(d, h) = invr()
		diff = max(diff, d - h)
		boro = max(boro, d)
	if diff == -1:
		if x <= boro:
			print(1)
		else:
			print(-1)
	elif diff == 0:
		if x <= boro:
			print(1)
		else:
			print(-1)
	elif x <= boro:
		print(1)
	else:
		lagbe = (x - boro + diff - 1) // diff
		print(lagbe + 1)


import sys
input = sys.stdin.readline

def main():
	Q = int(input())
	data = []
	for _ in range(Q):
		(N, X) = map(int, input().split())
		D = []
		A = []
		for _ in range(N):
			(d, h) = map(int, input().split())
			D.append(d - h)
			A.append(d)
		data.append((N, X, D, A))
	for (N, X, D, A) in data:
		d = max(D)
		b = max(A)
		score = X - b
		if score <= 0:
			print(1)
		elif d <= 0:
			print(-1)
		else:
			c = score // d + 1
			if score % d != 0:
				c += 1
			print(c)
main()


import math
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split(' '))
	(maxD, maxDH) = (0, -math.inf)
	for i in range(n):
		(di, hi) = map(int, input().split(' '))
		maxD = max(maxD, di)
		maxDH = max(maxDH, di - hi)
	if x <= maxD:
		print(1)
	elif maxDH <= 0:
		print(-1)
	else:
		x -= maxD
		print(1 + (x + maxDH - 1) // maxDH)


import math
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	maxi = 0
	dif = 0
	for _ in range(n):
		(d, h) = map(int, input().split())
		dif = max(dif, d - h)
		maxi = max(maxi, d)
	if maxi >= x:
		print(1)
	elif dif == 0:
		print(-1)
	else:
		x -= maxi
		q = x // dif
		x = x - q * dif
		if x % dif:
			q += 1
		print(q + 1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	s = float('inf')
	mm = 0
	ss = []
	for _ in range(n):
		(m, a) = map(int, input().split())
		mm = max(mm, m)
		if m > a:
			ss.append(m - a)
	f = 0
	if mm >= x:
		s = 1
		f = 1
	else:
		n1 = len(ss)
		if n1 == 0:
			s = -1
			f = 1
		else:
			for _ in range(n1):
				s = min((x - mm + ss[_] - 1) // ss[_], s)
	print(s if f == 1 else s + 1)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	maxx = 0
	maxxx = 0
	for o in range(n):
		(d, h) = map(int, input().split())
		if d - h > maxx:
			maxx = d - h
		if d > maxxx:
			maxxx = d
	if maxx != 0 or maxxx >= x:
		if maxxx >= x:
			print(1)
		else:
			if (x - maxxx) % maxx > 0:
				u = 1
			else:
				u = 0
			print((x - maxxx) // maxx + u + 1)
	else:
		print(-1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	mx = 0
	d = 0
	for i in range(n):
		(k, h) = map(int, input().split())
		mx = max(mx, k)
		d = max(d, k - h)
	if mx >= x:
		print(1)
	elif d == 0:
		print(-1)
	elif (x - mx) % d == 0:
		print(max(1, (x - mx) // d + 1))
	else:
		print(max(1, (x - mx) // d + 2))


q = int(input())
g = 0
k = 0
r = 0
for i in range(q):
	(n, x) = map(int, input().split())
	for j in range(n):
		(d, h) = map(int, input().split())
		r = max(r, d)
		if d > h:
			g = 1
			l = k
			k = max(k, d - h)
	if g == 1 and x > r:
		print(max(x - r, 0) // k + 1 if (x - r) % k == 0 else max(x - r, 0) // k + 2)
	elif x > r:
		print(-1)
	else:
		print(1)
	g = 0
	k = 0
	r = 0


import sys
import math
import bisect
import itertools

def solve(x, damage, head):
	n = len(damage)
	max_damage = max(damage)
	max_delta = -10 ** 18
	for i in range(n):
		delta = damage[i] - head[i]
		max_delta = max(max_delta, delta)
	if x <= max_damage:
		return 1
	if max_delta <= 0:
		return -1
	return (x - max_damage + max_delta - 1) // max_delta + 1

def main():
	for _ in range(int(input())):
		(n, x) = map(int, input().split())
		damage = []
		head = []
		for i in range(n):
			(a, b) = map(int, input().split())
			damage.append(a)
			head.append(b)
		ans = solve(x, damage, head)
		print(ans)
main()


import math
t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	ans = math.inf
	arr = []
	maxStr = 0
	for j in range(n):
		(d, h) = list(map(int, input().split()))
		if d > maxStr:
			maxStr = d
		arr.append(d - h)
	arr = sorted(arr)
	x -= maxStr
	if x <= 0:
		print(1)
		continue
	if x > 0 and arr[-1] <= 0:
		print(-1)
		continue
	print(x // arr[-1] + min(x % arr[-1], 1) + 1)


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
N = 10 ** 10 + 7
for _ in range(I()):
	(n, x) = R()
	mx = 0
	mx_d = []
	for i in range(n):
		(d, h) = R()
		mx = max(d, mx)
		mx_d += (d - h,)
	mx_d = max(mx_d)
	if x > mx and mx_d <= 0:
		print(-1)
	elif mx >= x:
		print(1)
	else:
		print((x - mx + mx_d - 1) // mx_d + 1)


from math import ceil
for i in range(int(input())):
	(n, x) = map(int, input().split())
	a = b = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		a = max(a, d)
		b = max(b, d - h)
	if a >= x:
		print(1)
	elif b <= 0:
		print(-1)
	else:
		print(ceil((x - a) / b) + 1)


from sys import stdin

def ler():
	for line in stdin:
		yield line

def solve(s):
	(n, vida) = [int(x) for x in next(s).split(' ')]
	maior_dano = 0
	melhor_dano_regen = 0
	for i in range(n):
		(dano, regen) = [int(x) for x in next(s).split(' ')]
		maior_dano = max(dano, maior_dano)
		melhor_dano_regen = max(melhor_dano_regen, dano - regen)
	vida -= maior_dano
	if vida <= 0:
		return 1
	if melhor_dano_regen < 1:
		return -1
	return 1 + vida // melhor_dano_regen + (1 if vida % melhor_dano_regen > 0 else 0)
s = ler()
a = int(next(s))
while a > 0:
	print(solve(s))
	a -= 1


import math

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

def solve_zmei():
	(blows_count, heads) = get_integers()
	blows = []
	for _ in range(blows_count):
		blows.append(get_integers())
	max_cut = max([t[0] for t in blows])
	max_delta = max([t[0] - t[1] for t in blows])
	if max_cut < heads and max_delta <= 0:
		print(-1)
		return
	if max_cut >= heads:
		print(1)
		return
	iterative_cuts = max(math.ceil((heads - max_cut) / max_delta), 0)
	print(iterative_cuts + 1)

def go_zmei():
	T = get_integers()[0]
	for i in range(T):
		solve_zmei()
go_zmei()


R = lambda : map(int, input().split())
for _ in [0] * int(input()):
	(n, x) = R()
	l = m = 0
	for _ in [0] * n:
		(d, h) = R()
		l = max(l, d)
		m = max(m, d - h)
	print(1 if l >= x else -1 if m < 1 else -(-(x - l) // m) + 1)


import math
n = int(input())
for i in range(0, n):
	p = input().rstrip().split(' ')
	l = []
	q = []
	w = []
	S = []
	D = []
	for j in range(0, int(p[0])):
		o = input().rstrip().split(' ')
		l.append(int(o[0]))
		q.append(int(o[1]))
		w.append(int(o[0]) - int(o[1]))
	V = max(w)
	if V <= 0:
		I = 0
		G = -1
		J = len(l) - 1
		l.sort(key=int)
		while I <= J:
			m = (I + J) // 2
			if l[m] >= int(p[1]):
				G = 1
				break
			else:
				I = m + 1
		print(G)
	else:
		A = w.index(V)
		if V >= int(p[1]):
			print(1)
		else:
			W = max(l)
			if W >= int(p[1]):
				print(1)
			else:
				D = 0
				N = int(p[1])
				C = math.ceil((N - W) / V)
				D += C
				D += 1
				print(D)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	max_d = max_e = 0
	for _ in range(n):
		(d, h) = map(int, input().split())
		max_d = max(d, max_d)
		max_e = max(max_e, d - h)
	if max_d >= x:
		print(1)
	elif max_e != 0:
		print(int((x - max_d + max_e - 1) // max_e + 1))
	else:
		print(-1)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	(c, d) = (0, 0)
	for i in range(n):
		(a, b) = map(int, input().split())
		c = max(c, a - b)
		d = max(d, a)
	if c <= 0:
		if d < x:
			print(-1)
		else:
			print(1)
	elif d >= x:
		print(1)
	else:
		print((x - d - 1) // c + 2)


import math
t = int(input())
for case in range(t):
	(n, x) = [int(s) for s in input().split(' ')]
	d_max = 0
	e_max = 0
	for i in range(n):
		(d, h) = [int(s) for s in input().split(' ')]
		d_max = max(d_max, d)
		e_max = max(e_max, d - h)
	if e_max <= 0 and d_max < x:
		ans = -1
	elif d_max >= x:
		ans = 1
	else:
		ans = (x - d_max) // e_max + int((x - d_max) % e_max != 0) + 1
	print(ans)


from sys import stdin, stdout
from math import ceil
global mxd

class Val:

	def __init__(self, d, h, x):
		self.h = d - h
		self.x = x
		global mxd
		mxd = max(mxd, d)

	def __lt__(self, other):
		return self.h > other.h
ans = []
for i in range(int(stdin.readline())):
	global mxd
	mxd = 0
	val = (lambda q, x: [(lambda d, h: Val(d, h, x))(*map(int, stdin.readline().split())) for j in range(q)])(*map(int, stdin.readline().split()))
	val.sort()
	if val[0].x <= mxd:
		ans.append('1')
	elif val[0].h <= 0:
		ans.append('-1')
	else:
		ans.append(str((val[0].x - mxd + val[0].h - 1) // val[0].h + 1))
stdout.write('\n'.join(ans))


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	max_blow = 0
	max_di = 0
	for j in range(n):
		(di, hi) = map(int, input().split())
		if di - hi > max_blow:
			max_blow = di - hi
		if di > max_di:
			max_di = di
	if max_di >= x:
		print(1)
	elif max_blow != 0:
		x_aux = x - max_di
		count = 1
		count += x_aux // max_blow
		x_aux = x_aux - x_aux // max_blow * max_blow
		if x_aux > 0:
			count += 1
		print(count)
	else:
		print(-1)


import math

def handle_case(heads, blows):
	ds = list(map(lambda x: x[0], blows))
	hs = list(map(lambda x: x[1], blows))
	diffs = [ds[i] - hs[i] for i in range(len(ds))]
	max_diff = max(diffs)
	max_d = max(ds)
	if max_diff <= 0 and heads > max_d:
		c = -1
	else:
		heads = heads - max_d
		c = 1
		if heads > 0:
			c += math.ceil(heads / max_diff)
	print(c)

def run():
	queries = eval(input())
	total_heads = []
	total_blows = []
	for _ in range(queries):
		(n, heads) = list(map(int, input().split()))
		total_heads.append(heads)
		blows = []
		for _ in range(n):
			(d, h) = list(map(int, input().split()))
			blows.append((d, h))
		total_blows.append(blows)
	for i in range(len(total_blows)):
		handle_case(total_heads[i], total_blows[i])
run()


from math import ceil
import math
N = int(input())
while N != 0:
	ref1 = 0
	ref2 = 0
	(n, x) = map(int, input().split())
	res = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		ref1 = max(ref1, a)
		res = max(res, a - b)
	cont = 0
	if ref1 >= x:
		print(1)
	elif res <= 0:
		print(-1)
	else:
		print(ceil((x - ref1) / res) + 1)
	N -= 1


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
(test,) = Neo()
for _ in range(test):
	(n, x) = Neo()
	md = -1
	mc = -1
	for __ in range(n):
		(d, h) = Neo()
		md = max(d, md)
		mc = max(mc, d - h)
	if md >= x:
		print(1)
	elif mc <= 0:
		print(-1)
	else:
		x -= md
		print(math.ceil(x / mc) + 1)


import math
t = int(input())
for case_num in range(t):
	(n, x) = map(int, input().split(' '))
	d = []
	h = []
	delta = []
	for i in range(n):
		(di, hi) = map(int, input().split(' '))
		d.append(di)
		h.append(hi)
		delta.append(di - hi)
	md = max(d)
	mdelta = max(delta)
	if md < x and mdelta <= 0:
		print(-1)
	elif md >= x:
		print(1)
	else:
		print(max(0, math.ceil((x - md) / mdelta)) + 1)


from math import ceil
Q = int(input().strip())
for q in range(Q):
	(nbs, heads) = [int(x) for x in input().strip().split()]
	bs = []
	for i in range(nbs):
		bs.append(tuple([int(x) for x in input().strip().split()]))
	strongest = max([x[0] for x in bs])
	Mdiff = max([x[0] - x[1] for x in bs])
	if Mdiff <= 0:
		if strongest < heads:
			print(-1)
		else:
			print(1)
		continue
	res = ceil(max(heads - strongest, 0) / Mdiff) + 1
	print(res)


t = int(input())
while t > 0:
	t -= 1
	(n, x) = map(int, input().split())
	a = 0
	mx = -10 ** 17
	for i in range(n):
		(aa, bb) = map(int, input().split())
		mx = max(aa, mx)
		if aa > bb:
			a = max(a, aa - bb)
	if x <= mx:
		print(1)
	elif a <= 0:
		print(-1)
	else:
		gg = (x - mx) // a
		print(1 + (1 + gg if (x - mx) % a != 0 else gg))


import math
t = int(input())
for i in range(t):
	blows = []
	(n, x) = [int(item) for item in input().split()]
	max_d = 0
	for i in range(n):
		(d, h) = [int(item) for item in input().split()]
		blows.append(d - h)
		max_d = max(max_d, d)
	blows.sort(reverse=True)
	if max_d >= x:
		print(1)
		continue
	elif blows[0] <= 0:
		print(-1)
		continue
	ans = math.ceil((x - max_d) / blows[0]) + 1
	print(ans)


n = int(input())
for i in range(n):
	(r, h) = map(int, input().split())
	blow = []
	mx = 0
	v = -1
	g = -1
	for j in range(r):
		(a, b) = map(int, input().split())
		blow.append([a, b])
		if a - b > mx:
			mx = a - b
			v = a
			g = b
	blow = sorted(blow, reverse=True)
	c = 0
	while h > 0:
		if blow[0][0] >= h:
			c += 1
			h = 0
			break
		else:
			if mx <= 0:
				c = -1
				break
			need = h - blow[0][0]
			mul = (need + v - 1) // v
			h -= mul * v
			h += g * mul
			c += mul
			if h <= 0:
				break
	print(c)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	(a, b) = zip(*(map(int, input().split()) for _ in range(n)))
	x -= max(a)
	if x <= 0:
		print(1)
	else:
		t = 1e+20
		for i in range(n):
			d = a[i] - b[i]
			if d > 0:
				t = min(t, (x + d - 1) // d)
		if t < 1e+19:
			print(t + 1)
		else:
			print(-1)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	(d, h) = ([], [])
	c = 0
	for f in range(n):
		(a, b) = map(int, input().split())
		d.append(a)
		h.append(b)
		if a - b > c:
			c = a - b
	if not c and max(d) < x:
		print(-1)
	else:
		an = x - max(d)
		if an <= 0:
			print(1)
		else:
			an //= c
			if (x - max(d)) % c:
				an += 1
			print(an + 1)


from collections import defaultdict as DD
from bisect import bisect_left as BL
from bisect import bisect_right as BR
from itertools import combinations as IC
from itertools import permutations as IP
from random import randint as RI
import sys
MOD = pow(10, 9) + 7

def IN(f=0):
	if f == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
tc = IN(1)
for _ in range(tc):
	(n, x) = IN()
	a = []
	maxD = -1
	for i in range(n):
		(f, y) = IN()
		maxD = max(maxD, f)
		a.append(f - y)
	i = 0
	a.sort(reverse=True)
	x = x - maxD
	if x <= 0:
		print(1)
	elif a[0] <= 0:
		print(-1)
	else:
		r = x / a[0]
		if int(r) != r:
			r = int(r) + 1
		print(int(r + 1))


import math
t = int(input())
f = []
for i in range(t):
	(n, x) = map(int, input().split())
	max1 = 0
	max2 = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		max1 = max(max1, a)
		max2 = max(max2, a - b)
	if max1 >= x:
		f += [1]
	elif max2 > 0:
		f += [1 + math.ceil((x - max1) / max2)]
	else:
		f += [-1]
for i in f:
	print(i)


q = int(input())
while q:
	(n, x) = [int(x) for x in input().split()]
	shots = []
	for i in range(n):
		(d, h) = [int(x) for x in input().split()]
		shots.append([d, h])
	best_shot = 0
	diff = 0
	for (damage, heads) in shots:
		diff = max(diff, damage - heads)
		best_shot = max(damage, best_shot)
	if best_shot >= x:
		print(1)
	elif diff == 0:
		print(-1)
	else:
		print((x - best_shot + diff - 1) // diff + 1)
	q -= 1


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	(d, h) = ([None] * n, [None] * n)
	md = 0
	mr = 0
	for i in range(n):
		(d[i], h[i]) = map(int, input().split())
		md = max(md, d[i])
		mr = max(mr, d[i] - h[i])
	x -= md
	if x <= 0:
		print(1)
	elif mr <= 0:
		print(-1)
	else:
		print(1 + (x + mr - 1) // mr)


from bisect import bisect_left as bl
from collections import defaultdict as dd
for _ in range(int(input())):
	(n, x) = [int(i) for i in input().split()]
	l = []
	f = dd(int)
	for j in range(n):
		(d, h) = [int(i) for i in input().split()]
		l.append(d - h)
		f[d] = 1
	l.sort(reverse=1)
	ans = 1
	x -= max(f.keys())
	if x <= 0:
		print(ans)
	else:
		if l[0] <= 0:
			ans = -1
		else:
			ans = x // l[0]
			if x % l[0] == 0:
				ans += 1
			else:
				ans += 2
		print(ans)


from math import *
from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	(n, h) = M()
	flag = 0
	m = 0
	mi = 0
	for j in range(n):
		(d, b) = M()
		mi = max(mi, d - b)
		if d >= h:
			flag = 1
		m = max(m, d)
	if flag:
		print(1)
	elif mi == 0:
		print(-1)
	else:
		print((h - m + (mi - 1)) // mi + 1)


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline

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

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

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

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

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

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

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

def mt(f):
	import time

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

def slv(N, X, DH):
	ans = sys.maxsize
	ld = 0
	ldd = 0
	for (d, h) in DH:
		ld = max(ld, d)
		ldd = max(ldd, d - h)
	if X <= ld:
		return 1
	if ldd <= 0:
		return -1
	X -= ld
	return 1 + math.ceil(X / ldd)

def main():
	T = read_int()
	for _ in range(T):
		(N, X) = read_int_n()
		DH = [read_int_n() for _ in range(N)]
		print(slv(N, X, DH))
main()


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')
import math
for j in range(int(input())):
	(n, x) = map(int, input().split())
	blows = []
	heal = []
	maxy = 0
	maxdiff = (0, 0)
	for s in range(n):
		(d, h) = map(int, input().split())
		blows.append(d)
		heal.append(h)
		diff = d - h
		if d > maxy:
			maxy = d
		if diff > maxdiff[0] - maxdiff[1]:
			maxdiff = (d, h)
	maxy = min(maxy, x)
	moves = -1
	if maxy == x:
		print(1)
	elif maxdiff[0] - maxdiff[1] > 0:
		print(1 + math.ceil((x - maxy) / (maxdiff[0] - maxdiff[1])))
	else:
		print(-1)


for i in range(int(input())):
	[n, x] = map(int, input().split())
	md = bd = 0
	for j in range(n):
		[d, h] = map(int, input().split())
		if d - h > bd:
			bd = d - h
		if d > md:
			md = d
	if md >= x:
		print(1)
	elif bd <= 0:
		print(-1)
	else:
		print((x - md) // bd + 1 if (x - md) % bd == 0 else (x - md) // bd + 2)


import sys
sys.setrecursionlimit(10 ** 5)
input = lambda : sys.stdin.readline().strip()
inp = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	(n, x) = inp()
	arr = [inp() for i in range(n)]
	d = max((i for (i, j) in arr))
	dh = max((i - j for (i, j) in arr))
	if x <= d:
		print(1)
	elif dh <= 0:
		print(-1)
	else:
		print((x - d + dh - 1) // dh + 1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	f = 0
	ans = 100000000000
	am = -10000000000
	dab = -10000000000
	for i in range(n):
		(a, b) = map(int, input().split())
		am = max(am, a)
		dab = max(dab, a - b)
	if am >= x:
		print(1)
	elif dab <= 0:
		print(-1)
	else:
		x -= am
		ans = x // dab + int(x % dab != 0) + 1
		print(ans)


query_number = int(input())
for i in range(query_number):
	(blow_type, head_number) = map(int, input().split())
	head_bashed = [0] * blow_type
	head_regenerated = [0] * blow_type
	for i in range(blow_type):
		(head_bashed[i], head_regenerated[i]) = map(int, input().split())
	efficient_head_bashing = 0
	blow_count = 0
	for i in range(blow_type):
		if efficient_head_bashing < head_bashed[i] - head_regenerated[i]:
			efficient_head_bashing = head_bashed[i] - head_regenerated[i]
	possibility_checker = 0
	if efficient_head_bashing > 0:
		possibility_checker = 1
	elif head_number <= max(head_bashed):
		possibility_checker = 1
	if possibility_checker == 0:
		print(-1)
	elif head_number <= max(head_bashed):
		print(1)
	elif (head_number - max(head_bashed)) / efficient_head_bashing == (head_number - max(head_bashed)) // efficient_head_bashing:
		print((head_number - max(head_bashed)) // efficient_head_bashing + 1)
	else:
		print((head_number - max(head_bashed)) // efficient_head_bashing + 2)


t = int(input())
for query in range(t):
	(n, x) = map(int, input().split())
	maxd = 0
	maxdelta = -1000000000
	for i in range(n):
		(d, h) = map(int, input().split())
		maxd = max(maxd, d)
		maxdelta = max(maxdelta, d - h)
	if maxdelta <= 0:
		if maxd >= x:
			print(1)
		else:
			print(-1)
	else:
		print((max(0, x - maxd) + maxdelta - 1) // maxdelta + 1)


import math

def solve(attacks, start_heads):
	maxD = 0
	maxDH = 0
	for (d, h) in attacks:
		maxD = max(d, maxD)
		maxDH = max(d - h, maxDH)
	if maxD >= start_heads:
		return 1
	if maxDH < 1:
		return -1
	return math.ceil((start_heads - maxD) / maxDH) + 1

def main():
	z = int(input())
	for _ in range(z):
		(n, h) = map(int, input().split())
		a = [map(int, input().split()) for _ in range(n)]
		print(solve(a, h))
main()


import math
import sys
t = int(input())
for te in range(t):
	d = []
	h = []
	(n, x) = map(int, input().split())
	for i in range(n):
		(d1, h1) = map(int, input().split())
		d.append(d1)
		h.append(h1)
	dmax = max(d)
	if dmax >= x:
		print(1)
	else:
		dhmax = -sys.maxsize
		for i in range(n):
			dhmax = max(d[i] - h[i], dhmax)
		if dhmax <= 0:
			print(-1)
		else:
			print(math.ceil((x - dmax) / dhmax) + 1)


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

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

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

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

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

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

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

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

def S():
	return input()

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

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

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

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

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

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

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

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, H) = LI()
		dh = [LI() for _ in range(n)]
		mdh = max([d - h for (d, h) in dh])
		md = max([d for (d, h) in dh])
		if H <= md:
			rr.append(1)
		elif mdh <= 0:
			rr.append(-1)
		else:
			rr.append((H - md + mdh - 1) // mdh + 1)
	return JA(rr, '\n')
print(main())


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
from math import ceil
t = ni()
for i in range(t):
	(n, x) = nm()
	maxd = 0
	maxdh = -int(1000000000.0)
	for j in range(n):
		(di, hi) = nm()
		if maxd < di:
			maxd = di
		if maxdh < di - hi:
			maxdh = di - hi
	ans = -1
	if maxd < x and maxdh < 1:
		print(ans)
	elif maxd >= x:
		print(1)
	elif maxd < x and maxdh > 0:
		ans = 1
		x = x - maxd
		ans += ceil(x / maxdh)
		print(ans)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	md = me = 0
	for _ in range(n):
		(d, h) = map(int, input().split())
		md = max(md, d)
		me = max(me, d - h)
	if md >= x:
		print(1)
	elif me:
		print((x - md - 1) // me + 2)
	else:
		print('-1')


from math import ceil
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = []
	max_p = 0
	for j in range(n):
		(p, q) = map(int, input().split())
		max_p = max(p, max_p)
		a.append((p, q))
	a.sort(key=lambda y: y[0] - y[1], reverse=True)
	min_k = 10 ** 9 + 1
	if max_p >= x:
		min_k = 1
	else:
		for item in a:
			d = item[0] - item[1]
			if d > 0:
				min_k = min(ceil((x - max_p) / d) + 1, min_k)
	if min_k == 10 ** 9 + 1:
		print(-1)
	else:
		print(min_k)


import math
t = int(input())
for _ in range(t):
	(n, x) = list(map(int, input().split()))
	blows = []
	heads = []
	for _ in range(n):
		(blow, head) = list(map(int, input().split()))
		blows.append(blow)
		heads.append(head)
	maxD = max(blows)
	maxDH = 0
	for i in range(n):
		if maxDH < blows[i] - heads[i]:
			maxDH = blows[i] - heads[i]
	if maxD >= x:
		print(1)
	elif maxDH <= 0:
		print(-1)
	else:
		print(int(math.ceil((x - maxD) / maxDH)) + 1)


from math import ceil
for i in range(int(input())):
	(n, x) = map(int, input().split())
	maxdif = 0
	d = h = 0
	mxd = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		mxd = max(mxd, a)
		if a - b > maxdif:
			d = a
			h = b
			maxdif = a - b
	if mxd >= x:
		print(1)
		continue
	if maxdif == 0:
		print(-1)
		continue
	ans = ceil((x - mxd) / maxdif) + 1
	print(ans)


t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	mi = 10 ** 9 + 7
	ma = 0
	l = []
	for i in range(n):
		(a, b) = list(map(int, input().split()))
		l.append((a, b))
		if a > ma:
			ma = a
	for (a, b) in l:
		if ma >= m:
			mi = 1
			break
		if a <= b:
			continue
		else:
			zz = (m - ma + (a - b - 1)) // (a - b)
			zz += 1
			if zz < mi:
				mi = zz
	if mi == 10 ** 9 + 7:
		print(-1)
	else:
		print(mi)


Q = int(input())
for q in range(Q):
	(n, x) = tuple(map(int, input().split()))
	arr = [tuple(map(int, input().split())) for i in range(n)]
	arr.sort()
	maximal = arr[-1][0]
	if maximal >= x:
		print(1)
		continue
	arr = [i if i[0] > i[1] else () for i in arr]
	arr.sort()
	while len(arr) != 0 and arr[0] == ():
		arr = arr[1:]
	if len(arr) == 0:
		print(-1)
		continue
	arr2 = [i[0] - i[1] for i in arr]
	arr2.sort()
	maximal2 = arr2[-1]
	count = (x - maximal) // maximal2
	if (x - maximal) % maximal2 != 0:
		count += 1
	print(count + 1)


import sys

def rint():
	return map(int, sys.stdin.readline().split())
t = int(input())
for tt in range(t):
	(n, x) = rint()
	d_max = -1
	diff_max = -1
	for i in range(n):
		(dd, hh) = rint()
		d_max = max(d_max, dd)
		diff_max = max(diff_max, dd - hh)
	if diff_max <= 0:
		if d_max < x:
			print(-1)
		else:
			print(1)
	else:
		if x <= d_max:
			print(1)
			continue
		ans = (x - d_max) // diff_max
		if (x - d_max) % diff_max:
			ans += 1
		print(ans + 1)


nb_queries = int(input())
all_config = []
R = lambda : map(int, input().split())
for i in range(nb_queries):
	blows = []
	(nb_types_blows, nb_heads) = list(R())
	for j in range(nb_types_blows):
		blows.append(list(R()))
	all_config.append((nb_heads, blows))

def bfs_on_symbolic_graph(initial_heads, nb_types_blows, blows):
	level = 0
	dictionary_of_state = {}
	stack = [initial_heads]
	new_stack = []
	while len(stack) != 0:
		for current_head in stack:
			dictionary_of_state[current_head] = True
			if current_head == 0:
				return level
			for i in range(nb_types_blows):
				new_stack.append(compute_new_nb_head(current_head, blows[i][0], blows[i][1]))
		if min(new_stack) >= max(stack):
			return -1
		m = min(new_stack)
		M = min(stack)
		if m == 0:
			return 1
		index_best_blow = new_stack.index(m)
		head_regrowth_for_best_blow = blows[index_best_blow][1]
		best_blow_damage = blows[index_best_blow][0]
		best_diminishing = M - m
		deadliest_blow = max([blow[0] for blow in blows])
		for i in range(deadliest_blow // best_diminishing, -1, -1):
			if best_diminishing * i + initial_heads % best_diminishing <= deadliest_blow:
				return initial_heads // best_diminishing - i + 1

def compute_new_nb_head(current_head, blow_damage, regrowth):
	if current_head - blow_damage <= 0:
		return 0
	else:
		return current_head - blow_damage + regrowth

def compute_min_number_blows(config):
	initial_nb_heads = config[0]
	blows = config[1]
	return bfs_on_symbolic_graph(initial_nb_heads, len(blows), blows)
for i in range(nb_queries):
	print(compute_min_number_blows(all_config[i]))


import sys

def line2ints():
	return [int(x) for x in sys.stdin.readline().split()]
t = int(sys.stdin.readline())
for query in range(t):
	(n, x) = line2ints()
	deltas = []
	max_blow = 0
	for i in range(n):
		(d, h) = line2ints()
		deltas.append(d - h)
		max_blow = max(max_blow, abs(d))
	deltas = sorted([x for x in deltas if x > 0], reverse=True)
	if len(deltas) < 1:
		print(1 if x <= max_blow else -1)
		continue
	if max_blow >= x:
		print(1)
		continue
	ans = (x - max_blow) // deltas[0]
	if (x - max_blow) % deltas[0] > 0:
		ans += 1
	ans += 1
	print(ans)


import math

def solve(n, x, blows):
	r = float('inf')
	dh = []
	maxd = max(blows)[0]
	for (d, h) in blows:
		if d >= x:
			return 1
		elif d <= h:
			continue
		dh.append((d - h, d, h))
		v = int(math.ceil((x - maxd) / (d - h))) + 1
		r = min(r, v)
	if not dh:
		return -1
	return r
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	blows = []
	for _ in range(n):
		(d, h) = map(int, input().split())
		blows.append((d, h))
	print(solve(n, x, blows))


t = int(input())
s = []
ss = []
sss = []
fin = []
import math
for i in range(t):
	(n, x) = map(int, input().split())
	for i in range(n):
		(d, h) = map(int, input().split())
		s.append(d)
		ss.append(h)
	a = x - max(s)
	for i in range(len(s)):
		b = s[i] - ss[i]
		sss.append(b)
	if a > 0 and max(sss) <= 0:
		fin.append(-1)
	elif a <= 0:
		fin.append(1)
	else:
		otv = math.ceil(a / max(sss)) + 1
		fin.append(otv)
	s.clear()
	ss.clear()
	sss.clear()
for i in range(len(fin)):
	print(fin[i])


import math

def getint():
	return int(input())

def getlist():
	return list(map(int, input().split()))
t = getint()
for _ in range(t):
	(n, x) = getlist()
	mx = 0
	mxx = -1
	for __ in range(n):
		(d, h) = getlist()
		mx = max(mx, d)
		mxx = max(mxx, d - h)
	if mx >= x:
		print(1)
		continue
	if mxx == -1:
		print(-1)
		continue
	if mxx == 0:
		if mx >= x:
			print(1)
		else:
			print(-1)
		continue
	ans = math.ceil((x - mx) / mxx)
	print(ans + 1)


import math

def f(el):
	return el[1] - el[0]
for _ in range(int(input())):
	(n, x) = list(map(int, input().split()))
	arr = []
	m = 0
	for i in range(n):
		tup = tuple(map(int, input().split()))
		m = max(m, tup[0])
		arr.append(tup)
	arr.sort(key=f)
	if m >= x:
		print(1)
		continue
	if arr[0][0] <= arr[0][1]:
		print(-1)
		continue
	xCop = x
	d = math.ceil(x / (arr[0][0] - arr[0][1])) - 1
	x -= d * (arr[0][0] - arr[0][1])
	xCop -= m
	d1 = math.ceil(xCop / (arr[0][0] - arr[0][1]))
	print(d1 + 1)


import sys
import copy
sys.setrecursionlimit(1000000)

def isGood(max_v, x, mid, max_d):
	x -= max_v * mid
	return x <= max_d
Q = int(input())
for _ in range(Q):
	(n, x) = map(int, input().split())
	(d, h) = ([], [])
	for i in range(n):
		(a, b) = map(int, input().split())
		d.append(a)
		h.append(b)
	max_v = max([d[i] - h[i] for i in range(n)])
	max_d = max(d)
	if max_d < x and max_v <= 0:
		print(-1)
		continue
	if x <= max_d:
		print(1)
		continue
	ok = int(1e+20)
	ng = -1
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if isGood(max_v, x, mid, max_d):
			ok = mid
		else:
			ng = mid
	print(ok + 1)


t = int(input())
while t > 0:
	(n, x) = input().split()
	n = int(n)
	x = int(x)
	flag = 0
	mi = -999999999999999
	dmax = 0
	while n > 0:
		n -= 1
		(d, h) = input().split()
		d = int(d)
		h = int(h)
		dmax = max(dmax, d)
		mi = max(mi, d - h)
	r = 1
	x -= dmax
	if x > 0:
		if mi <= 0:
			r = -1
		else:
			r += int((x + mi - 1) / mi)
	print(r)
	t -= 1


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
for _ in range(get_int()):
	(n, x) = get_list()
	a = [get_list() for i in range(n)]
	mx1 = max(a, key=lambda x: x[0] - x[1])
	mx2 = max(a, key=lambda x: x[0])[0]
	mx1 = mx1[0] - mx1[1]
	if x <= mx2 or not x:
		print(1)
	elif mx1 > 0:
		print((x - mx2 + mx1 - 1) // mx1 + 1)
	else:
		print(-1)


for q in range(int(input())):
	(n, x) = [int(i) for i in input().split()]
	mx1 = -(1 << 30)
	mx2 = -(1 << 30)
	for j in range(n):
		(a, b) = [int(i) for i in input().split()]
		mx1 = max(mx1, a)
		mx2 = max(mx2, a - b)
	d = x - mx1
	if d <= 0:
		print(1)
		continue
	if mx2 <= 0:
		print(-1)
		continue
	print(1 + (d + mx2 - 1) // mx2)


import os
import sys
from io import BytesIO, IOBase
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')
import time
start_time = time.time()
import collections as col
import math
from functools import reduce

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 solve():
	(N, X) = getInts()
	diff = []
	max_d = 0
	for n in range(N):
		(d, h) = getInts()
		max_d = max(max_d, d)
		diff.append(d - h)
	if max_d >= X:
		return 1
	diff.sort()
	if diff[-1] <= 0:
		return -1
	return (X - max_d) // diff[-1] + ((X - max_d) % diff[-1] > 0) + 1
for _ in range(getInt()):
	print(solve())


import math
for k in range(int(input())):
	(n, x) = map(int, input().split())
	(d, h) = ([], [])
	dd = []
	for i in range(n):
		(a, b) = map(int, input().split())
		d.append(a)
		h.append(b)
		dd.append(a - b)
	mxd = max(dd)
	mx = max(d)
	if x <= mx:
		print(1)
	elif mxd <= 0:
		print(-1)
	else:
		x -= mx
		print(1 + math.ceil(x / mxd))


import math
t = int(input())
for _ in range(t):
	(n, inithead) = map(int, input().split())
	dif = []
	desl = []
	for i in range(n):
		(des, hinc) = map(int, input().split())
		dif += [des - hinc]
		desl += [des]
	maxdes = max(desl)
	maxdif = max(dif)
	if maxdes < inithead and maxdif <= 0:
		print(-1)
	else:
		count = 1
		head = inithead - maxdes
		if head > 0:
			count += math.ceil(head / maxdif)
		print(count)


import math
query = int(input())
for i in range(query):
	(n, x) = map(int, input().split())
	(dmg, heads, diff) = ([], [], [])
	for j in range(n):
		(d, h) = map(int, input().split())
		dmg.append(d)
		heads.append(h)
		diff.append(d - h)
	max_dmg = max(dmg)
	max_diff = max(diff)
	if max_dmg >= x:
		print(1)
	elif max_diff <= 0:
		print(-1)
	else:
		x -= max_dmg
		output = math.ceil(x / max_diff)
		output = int(output) + 1
		print(output)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	d = []
	h = []
	for _ in range(n):
		(a, b) = map(int, input().split())
		d.append(a)
		h.append(b)
	for dd in d:
		if dd >= x:
			print(1)
			break
	else:
		best = -9999999999999
		best2 = max(d)
		for i in range(len(d)):
			best = max(best, d[i] - h[i])
		if best <= 0:
			print(-1)
		else:
			hmm = (x - best2) // best if (x - best2) % best == 0 else (x - best2) // best + 1
			hmm += 1
			yo = x // best if x % best == 0 else x // best + 1
			print(min(hmm, yo))


import math
t = int(input())
while t != 0:
	(n, x) = map(int, input().split())
	maxi = 0
	(uu, tt) = (0, 0)
	for i in range(n):
		(a, b) = map(int, input().split())
		if maxi < a - b:
			maxi = a - b
			uu = a
		if a > tt:
			tt = a
	if maxi == 0:
		if tt >= x:
			print(1)
		else:
			print(-1)
	else:
		ans = 1
		if x - tt <= 0:
			print(1)
		else:
			ans += math.ceil((x - tt) / maxi)
			print(ans)
	t -= 1


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

def ss():
	return [x for x in input()]

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

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

def r(s):
	return s[0] - s[1]
t = ii()
for i in range(t):
	(a, b) = mi()
	s = [si() for i in range(a)]
	maxout = max(s, key=lambda x: x[0])[0]
	maxin = max(s, key=lambda x: x[0] - x[1])
	maxin = maxin[0] - maxin[1]
	if b <= maxout:
		print(1)
	elif maxin <= 0:
		print(-1)
	else:
		print((b - maxout - 1) // maxin + 2)


import math
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	best = 0
	mx = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		best = max(d - h, best)
		mx = max(mx, d)
	if best == 0 and x > mx:
		print(-1)
		continue
	else:
		x -= mx
		if x <= 0:
			print(1)
			continue
		else:
			print(math.ceil(x / best) + 1)


from math import ceil
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	data = []
	md = -1
	for i in range(n):
		(d, h) = map(int, input().split())
		md = max(md, d)
		data.append([d, h, h - d])
	if md >= x:
		print(1)
		continue
	data.sort(key=lambda x: x[-1])
	(d, h, b) = data[0]
	if b >= 0:
		print(-1)
		continue
	b *= -1
	target = x - md
	maxt = ceil(target / b)
	mint = maxt - 1
	rem = x - b * (mint - 1)
	if rem > md:
		rem -= d
		ans = mint
		rem += h
	else:
		print(mint)
		continue
	if rem <= md:
		print(mint + 1)
	else:
		rem -= d
		ans = mint + 1
		rem += h
		print(ans + 1)


t = int(input())
v = []
for i in range(t):
	(n, x) = [int(s) for s in input().split()]
	flag = True
	m_step = 0
	d_step = 0
	for j in range(n):
		(d, h) = [int(z) for z in input().split()]
		if flag:
			flag = False
			d_step = d
			m_step = d - h
		else:
			if d > d_step:
				d_step = d
			if m_step < d - h:
				m_step = d - h
	if m_step <= 0 and d_step < x:
		v.append(-1)
	elif d_step >= x:
		v.append(1)
	else:
		if (x - d_step) % m_step == 0:
			r = (x - d_step) // m_step
		else:
			r = (x - d_step) // m_step + 1
		v.append(r + 1)
print(*v, sep='\n')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = 0
	max_d = 0
	for _ in range(n):
		(d, h) = map(int, input().split())
		a = max(a, d - h)
		max_d = max(max_d, d)
	if x <= max_d:
		print(1)
		continue
	if a <= 0:
		print(-1)
		continue
	print((x - max_d + a - 1) // a + 1)


a = int(input())
import math
for i in range(a):
	(n, x) = map(int, input().split())
	maxa = 0
	blow = math.inf
	for i in range(n):
		(p, q) = map(int, input().split())
		maxa = max(maxa, p)
		blow = min(blow, -p + q)
	if x <= maxa:
		print(1)
		continue
	if blow >= 0:
		print(-1)
		continue
	x -= maxa
	x = abs(x)
	blow = abs(blow)
	mpve = 1
	if x % blow == 0:
		mpve += x // blow
	else:
		mpve += x // blow + 1
	print(mpve)


from sys import stdin
t = int(stdin.readline().strip())
for caso in range(t):
	(n, x) = map(int, stdin.readline().strip().split())
	s = [list(map(int, stdin.readline().strip().split())) for i in range(n)]
	s.sort(reverse=True)
	mx = s[0]
	ans = 0
	mn = []
	for i in range(n):
		if s[i][0] - s[i][1] > ans:
			ans = s[i][0] - s[i][1]
			mn = s[i]
	dif = ans
	if mx[0] >= x:
		print(1)
		continue
	if dif <= 0:
		print(-1)
		continue
	aux = x - mx[0]
	if aux % ans != 0:
		aux = aux // ans
		aux += 1
	else:
		aux = aux // ans
	print(aux + 1)


from __future__ import division, print_function
import math

def main():
	for _ in range(int(input())):
		(n, x) = map(int, input().split())
		maxhit = 0
		maxprofit = 0
		for i in range(n):
			(d, h) = map(int, input().split())
			maxhit = max(maxhit, d)
			maxprofit = max(maxprofit, d - h)
		if maxprofit == 0 and maxhit < x:
			print(-1)
		elif maxhit >= x:
			print(1)
		else:
			ans = 1
			print(1 + math.ceil((x - maxhit) / maxprofit))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

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

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

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

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

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

class IOWrapper(IOBase):

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

class ostream:

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

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


t = int(input())
for T in range(t):
	(n, x) = map(int, input().split())
	f = -1
	(D, H, S) = ([], [], [])
	for N in range(n):
		(d, h) = map(int, input().split())
		D.append(d)
		H.append(h)
		S.append(d - h)
	m = max(D)
	if m >= x:
		f = 1
	else:
		i = S.index(max(S))
		(d, h) = (D[i], H[i])
	if d > h and f < 0:
		x -= m
		if x % (d - h):
			f = x // (d - h) + 2
		else:
			f = x // (d - h) + 1
	print(f)


import math

def testcase():
	(n, x) = map(int, input().split())
	D = []
	H = []
	best_damage = 0
	instant_kill = 0
	for _ in range(n):
		(d, h) = map(int, input().split())
		D.append(d)
		H.append(h)
		best_damage = max(best_damage, d - h)
		instant_kill = max(instant_kill, d)
	if instant_kill < x and best_damage == 0:
		return -1
	x -= instant_kill
	if x <= 0:
		return 1
	return math.ceil(x / best_damage) + 1
for _ in range(int(input())):
	print(testcase())


t = int(input())
while t:
	s = input().split()
	n = int(s[0])
	x = int(s[1])
	l = 0
	o = 0
	for i in range(n):
		s = input().split()
		d = int(s[0])
		h = int(s[1])
		e = d - h
		if l < d:
			l = d
		if o < e:
			o = e
	if x <= l:
		print(1)
	elif o == 0:
		print(-1)
	elif (x - l) % o == 0:
		print((x - l) // o + 1)
	else:
		print((x - l) // o + 2)
	t -= 1


from collections import Counter, defaultdict, deque
import heapq as hq
from itertools import count, islice
import math
import sys
input = sys.stdin.readline
tt = int(input())
for test in range(tt):
	(n, x) = [int(x) for x in input().split()]
	best = 0
	strongest = 0
	for i in range(n):
		(d, h) = [int(x) for x in input().split()]
		if d - h > best:
			best = d - h
		if d > strongest:
			strongest = d
	if x <= strongest:
		print(1)
		continue
	if best == 0:
		print(-1)
		continue
	else:
		print(math.ceil((x - strongest) / best) + 1)


import math
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	m = 987654321
	d = [0] * n
	h = [0] * n
	cnt = -1
	for j in range(n):
		(d[j], h[j]) = map(int, input().split())
	dmax = max(d)
	if dmax >= x:
		cnt = 1
	else:
		cu = -1
		for j in range(n):
			deal = d[j] - h[j]
			if cu < deal and deal > 0:
				cu = deal
		if cu > 0:
			cnt = math.ceil((x - dmax) / cu) + 1
		else:
			cnt = -1
	print(cnt)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
t = rint()
for _ in range(t):
	(n, x) = rints()
	max_red = 0
	max_blow = 0
	for __ in range(n):
		(d, h) = rints()
		max_red = max(max_red, d - h)
		max_blow = max(max_blow, d)
	if max_red == 0 and max_blow < x:
		print(-1)
		continue
	red_health = max(0, x - max_blow)
	print(1 if max_blow >= x else (red_health + max_red - 1) // max_red + 1)


import math as mt
import sys, string
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappush, heapify, heappop
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
for _ in range(n):
	(p, q) = M()
	l = []
	x = 0
	y = -10 ** 10
	for i in range(p):
		(d, h) = M()
		x = max(x, d)
		y = max(y, d - h)
	if x >= q:
		print(1)
	elif y <= 0:
		print(-1)
	else:
		print(int(mt.ceil((q - x) / y)) + 1)


for _ in [0] * int(input()):
	(b, h) = map(int, input().split())
	max_diff = 0
	md = 0
	mh = 0
	max_dam = 0
	time = 1
	for i in range(b):
		(tdi, thi) = list(map(int, input().split()))
		if max_diff < tdi - thi:
			max_diff = tdi - thi
			md = tdi
			mh = thi
		max_dam = max(max_dam, tdi)
	if max_dam >= h:
		print(time)
	elif max_diff == 0:
		print(-1)
	else:
		nt = (h - max_dam) / max_diff
		if nt > int(nt):
			nt = int(nt) + 1
		time = time + int(nt)
		print(time)


import math

def solve(x):
	if dbh == -1 or ebh == -1 or x <= 0:
		return 0
	if ebh - ebd >= 0 and dbd < x:
		return -1
	x -= dbd
	if x <= 0:
		return 1
	return math.ceil(1 + x / (ebd - ebh))
t = int(input())
for test in range(t):
	(n, x) = list(map(int, input().split()))
	dbh = -1
	dbd = -1
	ebh = -1
	ebd = -1
	for i in range(n):
		(td, th) = list(map(int, input().split()))
		if ebh == -1 or th - td < ebh - ebd:
			ebh = th
			ebd = td
		if dbh == -1 or td > dbd:
			dbh = th
			dbd = td
	print(solve(x))


from math import ceil
t = int(input())
for _ in range(t):
	(n, x) = [int(x) for x in input().split()]
	blows = []
	for _ in range(n):
		(d, h) = [int(x) for x in input().split()]
		blows.append((d, h))
	blows.sort(key=lambda x: x[0] - x[1])
	eff = blows[-1]
	blows.sort(key=lambda x: x[0])
	mhit = blows[-1]
	if x <= mhit[0]:
		print(1)
	elif eff[0] - eff[1] <= 0:
		print(-1)
	else:
		print(ceil((x - mhit[0]) / (eff[0] - eff[1])) + 1)


for _ in range(int(input())):
	(n, cur) = list(map(int, input().split()))
	diff = []
	lar = -1
	for i in range(n):
		(d, h) = list(map(int, input().split()))
		if lar < d:
			lar = d
		diff.append(d - h)
	m = max(diff)
	if cur <= lar:
		print(1)
	elif m <= 0:
		print(-1)
	else:
		cur -= lar
		count = cur // m
		if cur % m != 0:
			count += 1
		count += 1
		print(count)


import math

def exponent_mod(n, p, prime_const=1000000000 + 7):
	res = 1
	if n == 0:
		return 0
	while p > 0:
		if p % 2 == 1:
			res = res * n % prime_const
		p //= 2
		n = n * n % prime_const
	return res

def find_min_moves(n, x, info):
	maxDH = 0
	maxD = 0
	for (d, h) in info:
		maxDH = max(maxDH, d - h)
		maxD = max(maxD, d)
	if maxD >= x:
		return 1
	elif maxDH <= 0:
		return -1
	return math.ceil((x - maxD) / maxDH) + 1

def find_min_essays(n, r, avg, essays):
	times = 0
	count = 0
	s = 0
	required = 0
	for (grade, essay) in essays:
		s += grade
	if s < n * avg:
		required = n * avg - s
	essays.sort(key=lambda x: x[1])
	for (grade, essay) in essays:
		times = min(r - grade, required)
		count += essay * times
		required -= times
	return count
t = 1
t = int(input())
while t:
	t -= 1
	prime_const = pow(10, 9) + 7
	values = list(map(int, input().strip().split()))[:2]
	n = values[0]
	x = values[1]
	info = []
	for i in range(n):
		items = list(map(int, input().strip().split()))[:2]
		info.append([items[0], items[1]])
	print(find_min_moves(n, x, info))


import math
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = []
	md = -1
	for i in range(n):
		(d, h) = map(int, input().split())
		md = max(md, d)
		a.append(d - h)
	a = max(a)
	x = x - md
	if x > 0:
		if a <= 0:
			s = -1
		else:
			s = (x + a - 1) // a + 1
	else:
		s = 1
	print(s)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	blows = []
	heads = []
	diff = []
	for _ in range(n):
		(d, h) = map(int, input().split())
		blows.append(d)
		heads.append(h)
		diff.append(-d + h)
	cnt = 0
	while x >= 0:
		if max(blows) < x:
			if all([e >= 0 for e in diff]):
				print(-1)
				break
			else:
				if (x - max(blows)) % abs(min(diff)) > 0:
					cnt += (x - max(blows)) // abs(min(diff)) + 1
				else:
					cnt += (x - max(blows)) // abs(min(diff))
				x -= abs(min(diff)) * cnt
		else:
			print(cnt + 1)
			break


T = int(input())
for _ in range(T):
	(N, X) = map(int, input().split())
	A = -1
	B = -1
	for i in range(N):
		(d, h) = map(int, input().split())
		A = max(A, d - h)
		B = max(B, d)
	if B >= X:
		print(1)
	elif A > 0:
		print((X - B + A - 1) // A + 1)
	else:
		print(-1)


import math
t = int(input())
m = 0
while m < t:
	n_x = list(map(int, input().split()))
	d = []
	h = []
	b = []
	i = 0
	while i < n_x[0]:
		d_h = list(map(int, input().split()))
		d.append(d_h[0])
		h.append(d_h[1])
		b.append(d[i] - h[i])
		i = i + 1
	if n_x[1] <= max(d):
		tt = 1
	elif max(b) <= 0:
		tt = -1
	else:
		tt = math.ceil((n_x[1] - max(d)) / max(b)) + 1
	print(int(tt))
	m = m + 1


from sys import stdin
inp = lambda : stdin.readline().split()
for _ in range(int(stdin.readline())):
	(n, x) = map(int, inp())
	(item, D) = (0, 0)
	for i in range(n):
		(d, h) = map(int, inp())
		D = max(D, d)
		item = max(item, d - h)
	(res, x) = (1, max(0, x - D))
	if item > 0:
		(div, mod) = (x // item, x % item)
		if mod > 0:
			div += 1
		res += div
		print(res)
	elif x == 0:
		print(1)
	else:
		print(-1)


import math
for _ in range(int(input())):
	(n, head) = map(int, input().split())
	da = []
	ha = []
	diff = []
	for i in range(n):
		(d, h) = map(int, input().split())
		da.append(d)
		ha.append(h)
		diff.append(d - h)
	blow = max(diff)
	lastblow = max(da)
	if lastblow >= head:
		print(1)
	elif blow <= 0:
		print(-1)
	else:
		ans = 1 - (lastblow - head) / blow
		print(math.ceil(ans))


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	strong_blow = 0
	best_blow = 0
	for _ in range(n):
		(d, h) = map(int, input().split())
		if strong_blow < d - h:
			strong_blow = d - h
		if best_blow < d:
			best_blow = d
	if strong_blow > 0:
		t = max(0, x - best_blow) % strong_blow
		if t == 0:
			print(max(0, x - best_blow) // strong_blow + 1)
		else:
			print(max(0, x - best_blow) // strong_blow + 2)
	elif best_blow >= x:
		print(1)
	else:
		print(-1)


t = int(input())
l1 = []
for i in range(t):
	l3 = []
	k = 0
	l2 = []
	l4 = []
	(x, y) = map(int, input().split())
	for j in range(x):
		(a, b) = map(int, input().split())
		l3.append(a - b)
		l4.append(a)
	max1 = -1000000000000
	max2 = -1000000000000
	for j in range(x):
		if max1 < l3[j]:
			max1 = l3[j]
		if max2 < l4[j]:
			max2 = l4[j]
	if y - max2 <= 0:
		l1.append(1)
	elif max1 > 0:
		a = y - max2
		if a % max1 == 0:
			l1.append(int(a / max1) + 1)
		else:
			l1.append(int(a / max1) + 2)
	else:
		l1.append(-1)
for k in range(t):
	print(l1[k])


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	mx = 0
	dec = float('-inf')
	ar = [list(map(int, input().split())) for i in range(n)]
	for p in ar:
		mx = max(mx, p[0])
	if mx >= x:
		print(1)
		continue
	ar.sort(key=lambda x: x[1] - x[0])
	dec = ar[0]
	diff = dec[0] - dec[1]
	if diff <= 0:
		print(-1)
	else:
		to_mx = x - mx
		if to_mx % diff == 0:
			blow = to_mx // diff
		else:
			blow = to_mx // diff + 1
		blow += 1
		print(blow)


t = int(input())
for i in range(t):
	a = input().split(' ')
	n = int(a[1])
	m = 0
	eff = 0
	for j in range(int(a[0])):
		b = input().split(' ')
		m = max(m, int(b[0]))
		eff = max(eff, int(b[0]) - int(b[1]))
	n -= m
	if n > 0:
		if eff > 0:
			print((n - 1) // eff + 2)
		else:
			print(-1)
	else:
		print(1)


import math, sys, bisect, heapq, os
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
int1 = lambda x: int(x) - 1

def input():
	return sys.stdin.readline().rstrip('\r\n')
aj = lambda : list(map(int, input().split()))

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

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])

def solve():
	for _ in range(int(input())):
		(n, x) = aj()
		A = []
		m = 0
		for i in range(n):
			(a, b) = aj()
			A.append((a - b, a, b))
			m = max(m, a)
		A.sort(reverse=True)
		y = A[0][0]
		if x <= m:
			print(1)
		elif y <= 0:
			print(-1)
		else:
			step = 1 + math.ceil((x - m) / y)
			print(step)
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
solve()


import math
T = int(input())
for i in range(T):
	K = [int(x) for x in input().split()]
	num_weapons = K[0]
	heads = K[1]
	killed = []
	resurged = []
	for j in range(num_weapons):
		tmp = [int(x) for x in input().split()]
		killed.append(tmp[0])
		resurged.append(tmp[1])
	gain = [k - r for (k, r) in zip(killed, resurged)]
	best_gain = max(gain)
	best_kill = max(killed)
	if best_gain <= 0 and best_kill < heads:
		print(-1)
		continue
	if heads <= best_kill:
		print(1)
		continue
	print(math.ceil((heads - best_kill) / best_gain) + 1)


t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	x = int(l[1])
	maxa = 0
	ok = 0
	ans = 0
	for i in range(n):
		l = input().split()
		d = int(l[0])
		h = int(l[1])
		maxa = max(maxa, d)
		ok = max(ok, d - h)
	if maxa >= x:
		print(1)
		continue
	if ok == 0:
		print(-1)
		continue
	z = (x + ok - maxa - 1) // ok
	print(z + 1)


import math
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	combs = [None] * n
	for i in range(n):
		combs[i] = tuple(map(int, input().split()))
	hardest = max(combs, key=lambda kk: kk[0])
	if hardest[0] >= x:
		print(1)
	else:
		x -= hardest[0]
		clever = max(combs, key=lambda kk: kk[0] - kk[1])
		if clever[0] - clever[1] <= 0:
			print(-1)
		else:
			turns = math.ceil(x / (clever[0] - clever[1]))
			print(turns + 1)


import math
T = int(input())
p = 0
while p < T:
	(n, x) = [int(x) for x in input().split()]
	i = 0
	(dm, hm) = (0, 9987988851556798789)
	dmax = -1
	while i < n:
		(d, h) = [int(x) for x in input().split()]
		if d > dmax:
			dmax = d
		if d - h > dm - hm:
			dm = d
			hm = h
		i += 1
	x -= dmax
	if dm - hm <= 0 and x > 0:
		print(-1)
		p += 1
		continue
	count1 = 1
	if x > 0:
		count1 += math.ceil(x / (dm - hm))
	print(count1)
	p += 1


import sys
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	max1 = 0
	d = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		d = max(a - b, d)
		max1 = max(a, max1)
	if max1 >= x:
		print(1)
	elif d == 0:
		print(-1)
	else:
		val = (x - max1) // d + 1
		if (x - max1) % d != 0:
			val += 1
		print(val)


import math

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

def mi():
	return map(int, input().split())
T = ii()
for _ in range(T):
	(n, x) = mi()
	ans = -1
	mh = -math.inf
	m = -math.inf
	d = list()
	h = list()
	for _ in range(n):
		(di, hi) = mi()
		mh = max(mh, di - hi)
		m = max(m, di)
		d.append(di)
		h.append(hi)
	if x - m <= 0:
		ans = 1
	elif mh > 0:
		ans = 1 + math.ceil((x - m) / mh)
	print(ans)


t = int(input())
mas = []
m = []
for i in range(t):
	(n, x) = [int(i) for i in input().split()]
	d = [0] * n
	h = [0] * n
	for j in range(n):
		(d[j], h[j]) = [int(j) for j in input().split()]
		mas.append(d[j] - h[j])
	M1 = max(mas)
	M2 = max(d)
	if M2 >= x:
		m.append(1)
	elif M1 > 0:
		if (x + M1 - M2) % M1 == 0:
			m.append((x + M1 - M2) // M1)
		else:
			m.append((x + M1 - M2) // M1 + 1)
	else:
		m.append(-1)
	mas = []
for i in m:
	print(i)


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import math
alphabets = list('abcdefghijklmnopqrstuvwxyz')

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

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

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

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

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

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

def si():
	return input()

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

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

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

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

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

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')

def power_set(L):
	cardinality = len(L)
	n = 2 ** cardinality
	powerset = []
	for i in range(n):
		a = bin(i)[2:]
		subset = []
		for j in range(len(a)):
			if a[-j - 1] == '1':
				subset.append(L[j])
		powerset.append(subset)
	powerset_orderred = []
	for k in range(cardinality + 1):
		for w in powerset:
			if len(w) == k:
				powerset_orderred.append(w)
	return powerset_orderred

def fastPlrintNextLines(a):
	print('\n'.join(map(str, a)))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = 1
t = int(input())
for _ in range(t):
	(n, x) = li()
	netd = []
	d = []
	f = 0
	for i in range(n):
		l = li()
		netd.append(l[0] - l[1])
		if netd[-1] > 0:
			f = 1
		d.append(l[0])
	maxd = max(d)
	if x <= maxd:
		print(1)
		continue
	if f == 0:
		print(-1)
		continue
	maxatt = max(netd)
	times = divideCeil(x - maxd, maxatt)
	x = x - divideCeil(x - maxd, maxatt) * maxatt
	if x > 0:
		times += 1
	print(times)


from math import ceil
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	d = []
	mx = 0
	for i in range(n):
		a = list(map(int, input().split()))
		d.append(a)
		mx = max(mx, a[0])
	d = sorted(d, key=lambda x1: x1[1] - x1[0])
	x -= mx
	if x <= 0:
		print(1)
	elif d[0][0] - d[0][1] <= 0:
		print(-1)
	elif x % (d[0][0] - d[0][1]) == 0:
		print(1 + x // (d[0][0] - d[0][1]))
	else:
		print(2 + x // (d[0][0] - d[0][1]))


import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	c = -1
	md = -1
	for i in range(n):
		(d, h) = map(int, input().split())
		if d > h:
			if d - h > c:
				c = d - h
		if d > md:
			md = d
	if md >= x:
		print(1)
		continue
	if c == -1:
		print(-1)
		continue
	print(math.ceil((x - md) / c) + 1)


import sys, math

def main():

	def input():
		return sys.stdin.readline()[:-1]
	t = int(input())
	for z in range(t):
		(n, x) = map(int, input().split())
		b = [list(map(int, input().split())) for k in range(n)]
		b = sorted(b, key=lambda x: x[1] - x[0])
		bm = 0
		for e in b:
			bm = max(bm, e[0])
		t = b[0][0] - b[0][1]
		if t <= 0 and bm < x:
			print(-1)
		elif bm >= x:
			print(1)
		else:
			print(1 + math.ceil((x - bm) / t))
main()


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

class MergeFind:

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

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

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

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

	def __len__(self):
		return self.num_sets

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

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

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

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

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

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

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

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

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

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

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

def test_print(*args):
	if testingMode:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def display_2D_list(li):
	for i in li:
		print(i)

def prefix_sum(li):
	sm = 0
	res = []
	for i in li:
		sm += i
		res.append(sm)
	return res

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

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

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

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

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

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

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

def main():
	(n, x) = get_tuple()
	max_d = 0
	max_d_minus_h = 0
	for _ in range(n):
		(d, h) = get_tuple()
		max_d_minus_h = max(d - h, max_d_minus_h)
		max_d = max(d, max_d)
	if x > max_d and max_d_minus_h == 0:
		print(-1)
	elif max_d_minus_h == 0:
		print(1)
	else:
		print(max((-max_d + x + 2 * max_d_minus_h - 1) // max_d_minus_h, 1))
if TestCases:
	for i in range(get_int()):
		main()
else:
	main() if not optimise_for_recursion else threading.Thread(target=main).start()


from math import floor
q = int(input())
inf = 1000000000.0 + 9
for _ in range(q):
	(n, x) = map(int, input().split())
	max_beneficio = -inf
	d_valores = []
	for __ in range(n):
		(d, h) = map(int, input().split())
		max_beneficio = max(max_beneficio, d - h)
		d_valores.append(d)
	max_d = max(d_valores)
	ans = 1
	x -= max_d
	if x > 0:
		if max_beneficio <= 0:
			ans = -1
		else:
			ans += floor((x + max_beneficio - 1) / max_beneficio)
	print(ans)


t = int(input())
for cases in range(t):
	(n, x) = map(int, input().split())
	maxn = -2147483648
	maxm = 0
	h0 = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		if maxn < d - h:
			maxn = d - h
			h0 = h
		maxm = max(maxm, d)
	if x <= maxm:
		print(1)
	elif maxn <= 0:
		print(-1)
	else:
		temp = x - maxm
		if temp % maxn == 0:
			print(temp // maxn + 1)
		else:
			print(temp // maxn + 2)


from math import ceil
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	blows = []
	for i in range(n):
		blows.append(tuple(map(int, input().split())))
	if max(blows, key=lambda k: k[0])[0] < x and max([blows[i][0] - blows[i][1] for i in range(n)]) <= 0:
		print(-1)
	elif max(blows, key=lambda k: k[0])[0] >= x:
		print(1)
	else:
		max_finish = max(blows, key=lambda k: k[0])[0]
		max_net_attack = max([blows[i][0] - blows[i][1] for i in range(n)])
		moves = ceil((x - max_finish) / max_net_attack)
		x -= max_net_attack * moves
		if x > 0:
			moves += 1
		print(moves)


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

def read_list():
	return list(map(int, input().split(' ')))
t = read_int()
for _ in range(t):
	(n, x) = read_list()
	max_diff = -1
	max_d = -1
	for _ in range(n):
		(d, h) = read_list()
		max_d = max(max_d, d)
		max_diff = max(max_diff, d - h)
	if max_d >= x:
		print(1)
		continue
	if max_diff <= 0:
		print(-1)
		continue
	turns_required = (x - max_d) // max_diff + 1
	if (x - max_d) % max_diff == 0:
		print(turns_required)
	else:
		print(turns_required + 1)


import math
n = int(input())
for _ in range(n):
	(n, x) = map(int, input().split())
	a = []
	for _ in range(n):
		a.append(list(map(int, input().split())))
	diff = [a[0] - a[1] for a in a]
	diff.sort()
	a = sorted(a, key=lambda x: x[0])
	if diff[-1] <= 0:
		if x > a[-1][0]:
			print(-1)
		else:
			print(1)
	else:
		print(1 + max(0, math.ceil((x - a[-1][0]) / diff[-1])))


from collections import namedtuple
from math import ceil
Hit = namedtuple('Hit', ['d', 'h', 'eff'])
T = int(input())
for _ in range(T):
	(n, x) = map(int, input().split(' '))
	hits = []
	for i in range(n):
		(d, h) = map(int, input().split(' '))
		hits.append(Hit(d, h, d - h))
	max_eff = max(hits, key=lambda row: row.eff).eff
	max_damage = max(hits, key=lambda row: row.d).d
	if x - max_damage > 0:
		if max_eff > 0:
			print(ceil((x - max_damage) / max_eff) + 1)
		else:
			print(-1)
	else:
		print(1)


from math import ceil

def main():
	t = int(input())
	for _ in range(t):
		(n, cur) = map(int, input().split())
		acc = []
		for _ in range(n):
			(d, h) = map(int, input().split())
			acc.append((h - d, d))
		dec_max = -min(acc)[0]
		dmax = max(acc, key=lambda x: x[1])[1]
		if dec_max <= 0 and cur > dmax:
			print(-1)
		elif dec_max <= 0 and cur <= dmax:
			print(1)
		else:
			steps = ceil(max(0, cur - dmax) / dec_max) + 1
			print(steps)
main()


from math import ceil

def get_highest_diff(a):
	return max(map(lambda kv: kv[0] - kv[1], a))

def get_num_blows(blows, heads):
	max_hit = max(map(lambda t: t[0], blows))
	best_blow = get_highest_diff(blows)
	if max_hit >= heads:
		return 1
	elif best_blow < 1:
		return -1
	else:
		return ceil((heads - max_hit) / best_blow) + 1
queries = int(input())
for _ in range(queries):
	(bs, h) = map(int, input().split())
	blows = []
	for _ in range(bs):
		blows.append(tuple(map(int, input().split())))
	print(get_num_blows(blows, h))


t = int(input())
from math import ceil
for _ in range(t):
	(n, x) = map(int, input().split())
	l = []
	flag = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append([b - a, a])
		if a >= x:
			flag = 1
	if flag == 1:
		print(1)
		continue
	l.sort()
	mini = 10 ** 18
	for i in range(len(l)):
		for j in range(len(l)):
			if l[i][0] < 0:
				k = ceil((x - l[j][1]) / abs(l[i][0]))
				mini = min(k + 1, mini)
	if mini == 10 ** 18:
		print(-1)
	else:
		print(mini)


import math
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	blows = []
	max_damage = -1e+308
	max_turn_damage = -1e+308
	for n in range(n):
		blow = [int(tmp) for tmp in input().split()]
		max_damage = max(max_damage, blow[0])
		max_turn_damage = max(max_turn_damage, blow[0] - blow[1])
	if x <= max_damage:
		print(1)
	elif max_turn_damage < 1:
		print(-1)
	else:
		print(math.ceil((x - max_damage) / max_turn_damage) + 1)


import math
T = int(input())
for t in range(T):
	(n, x) = map(int, input().split())
	gs = [tuple(map(int, input().split())) for _ in range(n)]
	max_d = max((g[0] for g in gs))
	max_delta = max((g[0] - g[1] for g in gs))
	if x <= max_d:
		c = 1
	elif max_delta <= 0:
		c = -1
	else:
		c = math.ceil((x - max_d) / max_delta) + 1
	print(c)


import math
t = int(input())
while t > 0:
	(n, x) = map(int, input().split())
	a = 0
	b = 0
	max = 0
	for i in range(n):
		(p, q) = map(int, input().split())
		if p >= a:
			a = p
		if p - q > max:
			max = p - q
	x -= a
	ans = 1
	if x > 0:
		if max <= 0:
			print('-1')
		else:
			ans = math.ceil(x / max) + 1
			print(ans)
	else:
		print(ans)
	t -= 1


Q = int(input())
for i in range(Q):
	(n, curX) = map(int, input().split())
	(D0, D1) = (0, -10 ** 9)
	for i in range(n):
		(d, h) = map(int, input().split())
		if d - h > D1:
			D1 = d - h
		if d > D0:
			D0 = d
	if D1 <= 0:
		if D0 >= curX:
			print(1)
		else:
			print(-1)
	elif D0 >= curX:
		print(1)
	else:
		x = curX - D0
		if x / D1 == x // D1:
			print(x // D1 + 1)
		else:
			print(x // D1 + 2)


from math import ceil
t = int(input())
while t:
	d = []
	h = []
	df = []
	(n, x) = map(int, input().split())
	lol = 0
	mx = -1
	for i in range(n):
		(di, hi) = map(int, input().split())
		d.append(di)
		h.append(hi)
		if di >= x:
			lol = 1
		df.append((hi - di, di, hi))
		mx = max(mx, di)
	df.sort()
	if lol:
		print(1)
	elif df[0][0] >= 0:
		print(-1)
	else:
		ans = 1
		x -= mx
		ans += ceil(x / -df[0][0])
		print(ans)
	t -= 1


import math
t = int(input())
for _ in range(t):
	(n, x) = [int(x) for x in str(input()).split(' ')]
	max_kill = -1
	best = -1
	for i in range(n):
		(d, h) = [int(x) for x in str(input()).split()]
		max_kill = max(max_kill, d - h)
		best = max(best, d)
	if best >= x:
		print(1)
	elif max_kill <= 0:
		print(-1)
	else:
		ans = 1 + math.ceil((x - best) / max_kill)
		print(ans)


import math
t = int(input())
a = []
for i in range(t):
	(n, k) = map(int, input().split())
	m = 0
	c = 0
	for j in range(n):
		(p, q) = map(int, input().split())
		if p - q > m:
			m = p - q
		if p > c:
			c = p
	if m == 0:
		if k > c:
			print(-1)
		else:
			print(1)
	elif k <= c:
		print(1)
	else:
		f = math.ceil((k - c) / m)
		print(f + 1)


import sys, os, io

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

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

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

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

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = ri()
	for _ in range(tc):
		(n, x) = ria()
		ma = -99999999999999999999
		md = -99999999999999999999
		for i in range(n):
			(d, h) = ria()
			ma = max(d - h, ma)
			md = max(d, md)
		if md < x and ma <= 0:
			print(-1)
		elif md >= x:
			print(1)
		else:
			op = (x - md) // ma + 1
			if (x - md) % ma:
				op += 1
			print(op)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

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

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

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

class FastWriter(io.IOBase):

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

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

class FastStdin(io.IOBase):

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

class FastStdout(io.IOBase):

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


q = int(input())
for i in range(q):
	(n, x) = map(int, input().split())
	(D, H) = ([], [])
	for _ in range(n):
		(d, h) = map(int, input().split())
		D.append(d)
		H.append(h)
	X = [x - d for d in D]
	x_min = min(X)
	if x_min <= 0:
		print(1)
	else:
		R = [D[i] - H[i] for i in range(n)]
		r_max = max(R)
		if r_max <= 0:
			print(-1)
		else:
			print((x_min + r_max - 1) // r_max + 1)


t = int(input())

def minblows(n, x, blows):
	Max = blows[0][0]
	Min = blows[0][1] - blows[0][0]
	for i in range(n):
		Max = max(Max, blows[i][0])
		Min = min(Min, blows[i][1] - blows[i][0])
	if Max >= x:
		return 1
	if Min >= 0:
		return -1
	Count = (x - Max) // abs(Min)
	x += Count * Min
	if x > Max:
		x -= Min
		Count += 1
	if x > 0:
		return Count + 1
	return Count
for i in range(t):
	(n, x) = map(int, input().split())
	blows = []
	for j in range(n):
		blows.append(list(map(int, input().split())))
	print(minblows(n, x, blows))


import math
for _ in range(int(input())):
	(n, x) = [int(i) for i in input().split()]
	d = [[int(i) for i in input().split()] for j in range(n)]
	curr = d[0][0] - d[0][1]
	ma = d[0][0]
	for i in d:
		if i[0] - i[1] > curr:
			curr = i[0] - i[1]
		if i[0] > ma:
			ma = i[0]
	if x <= ma:
		print(1)
		continue
	elif curr <= 0:
		print(-1)
		continue
	a = x - ma
	y = math.ceil(a / curr)
	print(y + 1)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	maxDMH = 0
	maxD = 0
	for j in range(n):
		(d, h) = map(int, input().split())
		maxDMH = max(maxDMH, d - h)
		maxD = max(maxD, d)
	if x - maxD <= 0:
		print(1)
		continue
	if maxDMH <= 0:
		print(-1)
		continue
	print((x - maxD) // maxDMH + 2 if (x - maxD) % maxDMH > 0 else (x - maxD) // maxDMH + 1)


import math
for _ in range(int(input())):
	(n, x) = list(map(int, input().split()))
	ans = 0
	li = []
	mx = 0
	for _ in range(n):
		(a, b) = list(map(int, input().split()))
		mx = max(mx, a)
		li.append([a, b])
	li = sorted(li, key=lambda x: x[0] - x[1], reverse=True)
	if x <= mx:
		print(1)
		continue
	(a, b) = li[0]
	if a - b <= 0:
		print(-1)
		continue
	print(math.ceil((x - mx) / (a - b)) + 1)
	9


import math
import sys

def main():
	t = int(input())
	for test in range(t):
		(n, x) = sys.stdin.readline().split()
		n = int(n)
		x = int(x)
		arr = []
		for i in range(n):
			l = [int(i) for i in sys.stdin.readline().split()]
			arr.append(l)
		sys.stdout.write(str(math.ceil(count(n, x, arr))))
		sys.stdout.write('\n')

def count(n, x, arr):
	l = []
	r = []
	for i in range(n):
		l.append(arr[i][0])
		r.append(arr[i][0] - arr[i][1])
	lm = max(l)
	rm = max(r)
	if lm >= x:
		return 1
	if rm <= 0:
		return -1
	else:
		new = (x - lm) / rm
		if new < 1:
			return 2
		return new + 1
main()


R = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, x) = R()
	k = 0
	p = 0
	for i in range(n):
		(a, b) = R()
		k = max(k, a - b)
		p = max(p, a)
	if k <= 0:
		if p >= x:
			print(1)
		else:
			print(-1)
	elif p >= x:
		print(1)
	else:
		print((x - p + k - 1) // k + 1)


import math
T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	max_1 = 0
	max_2 = 0
	para = []
	for j in range(a):
		(c, d) = map(int, input().split())
		max_1 = max(max_1, c)
		max_2 = max(max_2, c - d)
	if max_1 >= b:
		print(1)
		continue
	elif max_2 > 0:
		k = math.ceil((b - max_1) / max_2) if b - max_1 >= 0 else 0
		print(k + 1)
	else:
		print(-1)


x = int(input())
for _ in range(x):
	(n, t) = map(int, input().split())
	l = []
	(m, g) = (0, 0)
	for _ in range(n):
		y = list(map(int, input().split()))
		l.append(y)
		if y[0] > m:
			m = y[0]
		if y[0] - y[1] > g:
			g = y[0] - y[1]
	if m >= t:
		print(1)
	elif g <= 0:
		print(-1)
	elif (t - m) % g == 0:
		print((t - m) // g + 1)
	else:
		print((t - m) // g + 2)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	m1 = 0
	m2 = -1000000000.0
	for i in range(n):
		(d, h) = map(int, input().split())
		m1 = max(m1, d)
		m2 = max(m2, d - h)
	if x <= m1:
		print(1)
	elif m2 <= 0:
		print(-1)
	else:
		ans = (x - m1 - 1) // m2 + 1
		print(ans + 1)


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)

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

def lint():
	return [int(x) for x in stdin.readline().split()]

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

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

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

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def Bs(a, x):
	i = 0
	j = 0
	left = 0
	right = len(a)
	flag = False
	while left < right:
		mi = (left + right) // 2
		if a[mi] <= x:
			left = mi + 1
			i += 1
		else:
			right = mi
			j += 1
	if left > 0 and a[left - 1] == x:
		return (i - 1, j)
	else:
		return (-1, -1)

def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
t = I()
for _ in range(t):
	(n, x) = lint()
	a = []
	m = 10 ** 9 + 7
	dm = 0
	for i in range(n):
		(d, h) = lint()
		dm = max(dm, d)
		a.append([d, h])
	if dm >= x:
		m = 1
	else:
		for i in range(n):
			(d, h) = a[i]
			if d - h > 0:
				m = min(m, math.ceil((x - dm) / (d - h)) + 1)
	if m == 10 ** 9 + 7:
		print(-1)
	else:
		print(m)


t = int(input())
for i in range(1, t + 1):
	(n, x) = map(int, input().split())
	k = 0
	t = 0
	for i in range(1, n + 1):
		(a, b) = map(int, input().split())
		if k < a - b:
			k = a - b
		if t < a:
			t = a
	if k == 0 and t < x:
		print(-1)
	elif t >= x:
		print(1)
	elif (x - t) % k == 0:
		print((x - t) // k + 1)
	else:
		print((x - t) // k + 2)


import sys
from math import ceil
test_case = int(sys.stdin.readline())
while test_case:
	test_case -= 1
	(n, x) = sys.stdin.readline().rstrip().split()
	(n, x) = (int(n), int(x))
	blow = [[0, 0, 0] for _ in range(n)]
	max_d = 0
	final_d = 0
	for i in range(n):
		(tmp1, tmp2) = sys.stdin.readline().rstrip().split()
		(blow[i][0], blow[i][1]) = (int(tmp1), int(tmp2))
		blow[i][2] = blow[i][0] - blow[i][1]
		if blow[i][2] > max_d:
			max_d = blow[i][2]
		if blow[i][0] > final_d:
			final_d = blow[i][0]
	if x <= final_d:
		print(1)
		continue
	if max_d <= 0:
		print(-1)
		continue
	print(ceil((x - final_d) / max_d) + 1)


from sys import stdin, stdout
from collections import Counter
import math

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def rmult_str():
	return stdin.readline().rstrip().split()

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)

def main():
	t = rsingle_int()
	for i in range(t):
		(n, x) = rmult_int()
		blows = []
		max_blow = 0
		max_d = -1
		max_max_d = -1
		for j in range(n):
			(d, h) = rmult_int()
			blow = d - h
			if blow > max_blow or (blow == max_blow and d > max_d):
				max_blow = blow
				max_d = d
			if d > max_max_d:
				max_max_d = d
		if max_max_d >= x:
			print(1)
		elif max_blow == 0:
			print(-1)
		else:
			cnt = math.ceil((x - max_max_d) / max_blow)
			cnt += 1
			print(cnt)
main()


import math
elem = int(input())
for x in range(elem):
	ar = []
	for i in input().split(' '):
		ar.append(int(i))
	maxD = 0
	maxDiff = 0
	for i in range(ar[0]):
		temp = []
		for i in input().split(' '):
			temp.append(int(i))
		if temp[0] - temp[1] > maxDiff:
			maxDiff = temp[0] - temp[1]
		if temp[0] > maxD:
			maxD = temp[0]
	if ar[1] - maxD <= 0:
		print(1)
		continue
	if maxDiff == 0:
		print(-1)
		continue
	ar[1] = ar[1] - maxD
	print(math.ceil(ar[1] / maxDiff) + 1)


from math import ceil
for i in range(int(input())):
	(n, x) = (int(s) for s in input().split())
	max_diff = -10 ** 10
	md = -10 ** 10
	for j in range(n):
		(d, h) = (int(s) for s in input().split())
		max_diff = max(max_diff, d - h)
		md = max(md, d)
	if max_diff <= 0 and md < x:
		print(-1)
	else:
		ans = 1
		x = max(0, x - md)
		if max_diff != 0:
			ans += ceil(x / max_diff)
		print(ans)


import math
q = int(input())
for _ in range(q):
	(n, x) = map(int, input().split())
	ans = 0
	flag = 0
	l = []
	factor = -1
	ash = -1
	sag = -1
	last = -1
	for i in range(n):
		(d, h) = map(int, input().split())
		if d - h > factor:
			factor = d - h
			ash = d
			sag = h
		last = max(last, d)
	if x <= last:
		print(1)
	elif factor <= 0:
		print(-1)
	else:
		print(math.ceil((x - last) / factor) + 1)


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

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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

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

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

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

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(n, x) = value()
	ans = inf
	max_d = 0
	a = []
	for i in range(n):
		(d, h) = value()
		max_d = max(d, max_d)
		a.append((d, h))
	x -= max_d
	if x <= 0:
		ans = 1
	for i in range(n):
		(d, h) = a[i]
		cur_ans = inf
		if d > h and x > 0:
			effect = d - h
			cur_ans = ceil(x / effect)
		ans = min(cur_ans + 1, ans)
	if ans == inf:
		ans = -1
	print(ans)


from math import ceil
for _ in range(int(input().strip())):
	(m, h) = [int(__) for __ in input().strip().split()]
	al = []
	arr = set()
	su = sum(arr)
	for i in range(m):
		(p, q) = [int(__) for __ in input().strip().split()]
		arr.add(p - q)
		al.append(p)
	al.sort()
	if h in al or al[-1] > h:
		print(1)
	elif max(arr) <= 0:
		print(-1)
	else:
		n = max((h - al[-1]) / max(arr), 0)
		print(ceil(n) + 1)


t = int(input())
from math import ceil
for i in range(t):
	(n, x) = map(int, input().split())
	s = [[int(i) for i in input().split()] for j in range(n)]
	mx = max([s[i][0] for i in range(n)])
	V = [s[i][0] - s[i][1] for i in range(n)]
	v = V
	v.sort(reverse=True)
	if mx >= x:
		print(1)
	elif v[0] <= 0:
		print('-1')
	else:
		cv = V.index(v[0])
		print(ceil((x - max(s[cv][0], mx)) / v[0]) + 1)


import sys
input = sys.stdin.buffer.readline

def solution():
	for _ in range(int(input())):
		(n, x) = map(int, input().split())
		d = []
		l = []
		for i in range(n):
			(a, b) = map(int, input().split())
			d.append(a - b)
			l.append(a)
		d.sort(reverse=True)
		l.sort(reverse=True)
		if l[0] >= x:
			print(1)
		elif d[0] < 1:
			print(-1)
		else:
			z = (x - l[0]) // d[0]
			if (x - l[0]) % d[0] != 0:
				z += 1
			print(z + 1)
solution()


def main():
	T = int(input())
	for case in range(T):
		(n, x) = map(int, input().strip().split())
		(maxa, maxb) = (0, 0)
		for i in range(n):
			(a, b) = map(int, input().strip().split())
			maxa = max(maxa, a - b)
			maxb = max(maxb, a)
		if maxb >= x:
			print(1)
		elif maxa == 0:
			print(-1)
		else:
			print((x + (maxa - 1) - maxb) // maxa + 1)
main()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	ef = 0
	max1 = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		max1 = max(max1, a)
		if ef < a - b:
			ef = a - b
	if max1 >= x:
		print(1)
	elif ef == 0:
		print(-1)
	else:
		print(1 + (x - max1 + ef - 1) // ef)


t = int(input(''))
import operator
import math
for q in range(t):
	a = input('').split(' ')
	n = int(a[0])
	ini = int(a[1])
	dif = []
	d = []
	h = []
	for i in range(n):
		a = input('').split(' ')
		d.append(int(a[0]))
		h.append(int(a[1]))
		dif.append(d[i] - h[i])
	mx = max(d)
	dif[0] = max(dif)
	if dif[0] <= 0:
		if mx >= ini:
			ans = 1
		else:
			ans = -1
	elif mx >= ini:
		ans = 1
	else:
		ans = 1 + math.ceil((ini - mx) / dif[0])
	print(ans)


t = int(input())
import math
for _ in range(t):
	(n, x) = map(int, input().split())
	a = []
	for _ in range(n):
		a.append(list(map(int, input().split())))
	m = 0
	g = a[0][0] - a[0][1]
	for i in a:
		m = max(m, i[0])
		g = max(g, i[0] - i[1])
	if x <= m:
		print(1)
	elif g > 0:
		print(math.ceil((x - m) / g) + 1)
	else:
		print(-1)


import sys
import bisect
import heapq
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

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

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

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

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

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

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

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

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	(n, x) = Ri()
	arr = []
	for i in range(n):
		temp = Ri()
		arr.append(temp)
	maxx = max([arr[i][0] for i in range(len(arr))])
	arr.sort(key=lambda x: -(x[0] - x[1]))
	flag = False
	ans = 0
	dif = arr[0][0] - arr[0][1]
	if x <= maxx:
		print(1)
	elif dif <= 0:
		print(-1)
	else:
		le = x - maxx
		print(ceil(le / dif) + 1)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	l = []
	m = -1
	for j in range(n):
		(a, b) = map(int, input().split())
		m = max(a, m)
		l.append((a - b, a))
	l.sort()
	val2 = l[-1][0]
	if m >= x:
		print(1)
		continue
	if val2 <= 0:
		print(-1)
		continue
	val = l[-1][1]
	mov = (x - 1 - m) // val2
	x -= mov * val2
	while x > m:
		x -= val2
		mov += 1
	print(mov + 1)


import sys
input = sys.stdin.readline

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

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

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

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

def addDictList(d, key, val):
	if key not in d:
		d[key] = []
	d[key].append(val)

def addDictInt(d, key, val):
	if key not in d:
		d[key] = 0
	d[key] = val

def addDictCount(d, key):
	if key not in d:
		d[key] = 0
	d[key] += 1

def addDictSum(d, key, val):
	if key not in d:
		d[key] = 0
	d[key] += val
t = getInt()
for _ in range(t):
	(n, x) = getVars()
	razn = 0
	maxD = 0
	for i in range(n):
		(d, h) = getVars()
		razn = max(razn, d - h)
		maxD = max(d, maxD)
	if razn == 0:
		if maxD < x:
			print(-1)
		else:
			print(1)
	else:
		x = max(x - maxD, 0)
		if x == 0:
			print(1)
		else:
			res = x // razn
			if x == res * razn:
				print(res + 1)
			else:
				print(res + 2)


import math
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	fl = 0
	ma = 0
	b = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		if d - h > ma:
			ma = d - h
		if d > b:
			b = d
		if d >= x:
			fl = 1
	if fl == 1:
		print(1)
	elif ma == 0:
		print(-1)
	else:
		z = x - b
		z = math.ceil(z / ma)
		z = z + 1
		print(z)


t = int(input())

def nhap():
	row = input().split(' ')
	return (int(row[0]), int(row[1]))

def solve():
	(n, x) = nhap()
	(d, h, diff) = ([], [], [])
	for i in range(n):
		(curx, cury) = nhap()
		d.append(curx)
		h.append(cury)
		diff.append(curx - cury)
	mx = max(diff)
	mxOneHit = max(d)
	if mxOneHit >= x:
		return 1
	if mx <= 0:
		return -1
	leng = x - mxOneHit
	return leng // mx + 1 - (leng % mx == 0) + 1
tmp = t
while t:
	t -= 1
	print(solve())


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	MaxDamage = 0
	Damage = 0
	result = 1
	for i in range(n):
		(a, b) = map(int, input().split())
		MaxDamage = max(MaxDamage, a)
		Damage = max(Damage, a - b)
	if Damage == 0 and x > MaxDamage:
		print(-1)
		continue
	x -= MaxDamage
	if x <= 0:
		print(1)
		continue
	g = x / Damage
	if g == int(g):
		print(int(g) + 1)
	else:
		g = int(g) + 1
		print(g + 1)


import math

class Read:

	@staticmethod
	def string():
		return 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)))

def solve():
	(n, x) = Read.list_int()
	data = []
	for i in range(n):
		data.append(Read.list_int())
	max_d = 0
	max_r = 0
	for d in data:
		max_d = max(max_d, d[0])
		max_r = max(max_r, d[0] - d[1])
	if max_d >= x:
		print(1)
		return
	if max_r == 0:
		print(-1)
		return
	print(math.ceil(max(x - max_d, 0) / max_r) + 1)
query_count = Read.int()
for j in range(query_count):
	solve()


from math import ceil
INF = float('inf')
for _ in range(int(input().strip())):
	(n, x) = [int(i) for i in input().strip().split(' ')]
	maxd = -1
	d = 0
	h = float('inf')
	for j in range(n):
		(dd, hh) = [int(i) for i in input().strip().split(' ')]
		if dd > maxd:
			maxd = dd
		if dd - hh > d - h:
			h = hh
			d = dd
	count = 0
	if x > 0:
		x -= maxd
		count += 1
	if x > 0 and d - h > 0:
		count += ceil(x / (d - h))
		x = 0
	print(count if x <= 0 else -1)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	kq = 0
	t = 0
	giam = 0
	for j in range(n):
		(d, h) = map(int, input().split())
		giam = min(giam, -d + h)
		t = max(t, d)
	if t >= x:
		kq = 1
	elif giam == 0:
		kq = -1
	else:
		kq = (x - t) // abs(giam)
		if kq * abs(giam) == x - t:
			kq += 1
		else:
			kq += 2
	print(kq)


import math
t = int(input())
for i in range(t):
	delta = input()
	delta = delta.split()
	for i in range(2):
		delta[i] = int(delta[i])
	heads = delta[1]
	m = 0
	s = []
	for i in range(delta[0]):
		gamma = input()
		gamma = gamma.split()
		for i in range(2):
			gamma[i] = int(gamma[i])
		s.append(gamma[0] - gamma[1])
		if gamma[0] > m:
			m = gamma[0]
	s.sort()
	val = s[-1]
	if heads <= m:
		print(1)
		continue
	if val <= 0:
		print(-1)
		continue
	heads -= m
	moves = math.ceil(heads / val) + 1
	print(moves)


def solve():
	(n, x) = map(int, input().split())
	best = 0
	mx = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		best = max(d - h, best)
		mx = max(mx, d)
	if best <= 0 and mx < x:
		print(-1)
		return
	elif best <= 0 and mx >= x:
		print(1)
		return
	x = max(0, x - mx)
	ans = x // best + (1 if x % best != 0 else 0) + 1
	print(ans)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


for i in range(int(input())):
	(n, x) = map(int, input().split())
	mx = 0
	mind = 1000000000000000000
	d1 = 0
	for i in range(n):
		(d, h) = map(int, input().split())
		if d - h > mx:
			mx = d - h
		d1 = max(d1, d)
	import math
	d = d1
	if x <= d1:
		print(1)
		continue
	if mx <= 0:
		print(-1)
		continue
	k = math.ceil((x - d) / mx) + 1
	print(k)


from math import ceil
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	(m, eff) = (0, 0)
	for _ in range(n):
		(d, h) = map(int, input().split())
		m = max(m, d)
		eff = max(eff, d - h)
	if m >= x:
		print(1)
	elif eff <= 0:
		print(-1)
	else:
		x -= m
		print(1 + ceil(x / eff))


class Struct:
	pass
f = open(0, 'r')
queryNumber = int(f.readline())
for i in range(queryNumber):
	l = f.readline().split()
	blowcount = int(l[0])
	heads = int(l[1])
	blows = []
	for j in range(blowcount):
		l = f.readline().split()
		o = Struct()
		(o.d, o.h) = [int(l[0]), int(l[1])]
		o.dmg = o.d - o.h
		blows.append(o)
	maximal = max(blows, key=lambda a: a.d)
	if maximal.d >= heads:
		print(1)
		continue
	if all(map(lambda a: a.dmg <= 0, blows)):
		print(-1)
		continue
	iter = 1
	heads = heads - maximal.d
	maximaldmg = max(blows, key=lambda a: a.dmg).dmg
	iter = iter + int(heads / maximaldmg) + (1 if heads % maximaldmg > 0 else 0)
	print(iter)


import math
for t in range(int(input())):
	(n, p) = map(int, input().split())
	maxd = 0
	maxdc = 0
	for x in range(n):
		(d, c) = map(int, input().split())
		maxd = max(maxd, d)
		maxdc = max(maxdc, d - c)
	if maxd - p >= 0:
		print(1)
	elif maxdc <= 0:
		print(-1)
	else:
		p -= maxd
		print(math.ceil(p / maxdc) + 1)