You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:
 - Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.
 - Throw one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.
The monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?

-----Constraints-----
 - 1 ≤ N ≤ 10^5
 - 1 ≤ H ≤ 10^9
 - 1 ≤ a_i ≤ b_i ≤ 10^9
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N H
a_1 b_1
:
a_N b_N

-----Output-----
Print the minimum total number of attacks required to vanish the monster.

-----Sample Input-----
1 10
3 5

-----Sample Output-----
3

You have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.

Difficulty: MEDIUM

Solutions:
(n, h) = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
b = [ab[i][1] for i in range(n)]
b.sort(reverse=True)
cnt = 0
ab.sort(key=lambda x: x[0], reverse=True)
k = 0
while k < n and ab[0][0] < b[k] and (h > 0):
	h -= b[k]
	k += 1
	cnt += 1
if h > 0:
	cnt += (h + ab[0][0] - 1) // ab[0][0]
print(cnt)


from math import ceil
(n, h) = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(n)]
max_a = max([lst[i][0] for i in range(n)])
b = sorted((lst[i][1] for i in range(n))) + [0]
for i in range(n - 1, -1, -1):
	b[i] += b[i + 1]
ans = 10 ** 10
for i in range(n + 1):
	hp = h - b[i]
	t = max(0, ceil(hp / max_a))
	t += n - i
	ans = min(ans, t)
print(ans)


import sys
(N, H) = map(int, sys.stdin.readline().split())
katanas = []
for i in range(N):
	(a, b) = map(int, sys.stdin.readline().split())
	katanas.append((a, b, i))
sk = sorted(katanas, reverse=True)
max_k = sk[0][0]
katanas.sort(key=lambda x: x[1], reverse=True)
ans = 0
i = 0
while H > 0:
	if i < N and katanas[i][1] > max_k:
		H -= katanas[i][1]
		i += 1
		ans += 1
	else:
		tmp = (H - 1) // max_k + 1
		H -= tmp * max_k
		ans += tmp
print(ans)


import math
(n, h) = map(int, input().split())
A = [0] * n
B = [0] * (n + 1)
for i in range(n):
	(A[i], B[i]) = map(int, input().split())
a = max(A)
B.sort(reverse=True)
cnt = 0
while h > 0:
	if a > B[0]:
		cnt += math.ceil(h / a)
		h -= math.ceil(math.ceil(h / a) * a)
	else:
		cnt += 1
		h -= B[0]
		B.pop(0)
print(cnt)


(N, H) = (int(i) for i in input().split())
ka = []
kb = []
for i in range(N):
	(a, b) = (int(i) for i in input().split())
	ka.append(a)
	kb.append(b)
kb.sort()
kb.reverse()
ma = max(ka)
hp = H
res = 0
for b in kb:
	if b < ma:
		continue
	hp = hp - b
	res += 1
	if hp <= 0:
		break
else:
	res += (hp + ma - 1) // ma
print(res)


(N, H) = map(int, input().split())
A = []
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
mxA = max(A)
B.sort(reverse=True)
ans = 0
for b in B:
	if b <= mxA or H <= 0:
		break
	H -= b
	ans += 1
if H > 0:
	ans += -(-H // mxA)
print(ans)


(n, h) = map(int, input().split())
(a, b) = ([], [])
for _ in range(n):
	(ai, bi) = map(int, input().split())
	(a.append(ai), b.append(bi))
(a.sort(), b.sort())
(ans, amax) = (0, a[-1])
for bi in b[::-1]:
	if bi <= amax or h <= 0:
		break
	h -= bi
	ans += 1
mod = (h + amax - 1) // amax
print(ans + mod if h > 0 else ans)


(n, h) = map(int, input().split())
(a, b) = ([], [])
for _ in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
max_a = max(a)
b.sort(reverse=True)
cnt = 0
for i in range(n):
	if b[i] < max_a:
		break
	h -= b[i]
	cnt += 1
	if h <= 0:
		break
if h > 0:
	cnt += (h - 1) // max_a + 1
print(cnt)


import sys
import math
(N, H) = [int(x) for x in input().split()]
A = []
B = []
for _ in range(N):
	(a, b) = [int(x) for x in input().split()]
	A.append(a)
	B.append(b)
B.sort(reverse=True)
max_a = max(A)
cnt = 0
for b in B:
	if b < max_a:
		break
	H -= b
	cnt += 1
	if H <= 0:
		print(cnt)
		return
cnt += int(math.ceil(H / max_a))
print(cnt)


(n, h) = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
m = max(a)
b.sort()
c = 0
while h > 0:
	if b and b[-1] > m:
		c += 1
		h -= b.pop()
	else:
		c -= h // -m
		h = 0
print(c)


from math import ceil
(N, H) = map(int, input().split())
B = []
maxa = 0
cnt = 0
for i in range(N):
	(a, b) = map(int, input().split())
	maxa = max(maxa, a)
	B.append(b)
B.sort(reverse=True)
for i in range(N):
	if B[i] < maxa:
		break
	cnt += 1
	H -= B[i]
	if H <= 0:
		print(cnt)
		exit(0)
cnt += ceil(H / maxa)
print(cnt)


(N, H) = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
	(a[i], b[i]) = map(int, input().split())
A = int(max(a))
B = [i for i in b if i > A]
B.sort(reverse=True)
Sum = 0
for i in range(len(B)):
	H -= B[i]
	Sum += 1
	if H <= 0:
		break
if H > 0:
	Sum += int((H - 1) // A) + 1
print(Sum)


(n, h) = map(int, input().split())
A = 0
B = []
for _ in range(n):
	(a, b) = map(int, input().split())
	if A < a:
		A = a
	B.append(b)
B.sort(reverse=True)
cnt = 0
for i in B:
	if A < i:
		h -= i
		cnt += 1
	if h <= 0:
		print(cnt)
		exit()
print(cnt + (h + A - 1) // A)


(n, h) = list(map(int, input().split()))
aa = []
bb = []
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	aa.append(a)
	bb.append(b)
maxa = max(aa)
bb.sort(reverse=True)
nage = 0
ch = 0
for i in range(n):
	if bb[i] >= maxa:
		nage += bb[i]
		ch += 1
	else:
		break
if h > nage:
	rest = h - nage
	ch1 = 0
	if rest % maxa == 0:
		ch1 += rest // maxa
	else:
		ch1 += rest // maxa + 1
	print(ch1 + ch)
else:
	ans = 0
	hp = 0
	for j in range(n):
		if hp >= h:
			break
		else:
			ans += 1
			hp += bb[j]
	print(ans)


import sys
(n, h) = map(int, input().split())
max_a = 0
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	max_a = max(max_a, x)
	b.append(y)
b = [x for x in b if x > max_a]
b.sort(reverse=True)
i = 0
if len(b) > 0:
	for (i, x) in enumerate(b):
		i += 1
		h -= x
		if h <= 0:
			print(i)
			return
print((h + max_a - 1) // max_a + i)


(n, h) = map(int, input().split())
A = []
B = []
for i in range(n):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
maxa = max(A)
C = []
B.sort(reverse=True)
ans = 0
for ele in B:
	if ele < maxa:
		break
	ans += 1
	h -= ele
	if h <= 0:
		break
if h > 0:
	ans += (h + maxa - 1) // maxa
print(ans)


import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce

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

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

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

def LIST():
	return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
(N, H) = MAP()
(A, B) = ([], [])
for i in range(N):
	(a, b) = MAP()
	A.append(a)
	B.append(b)
max_a = max(A)
B = sorted(B, reverse=True)
ans = 0
for i in range(N):
	if max_a >= B[i]:
		ans += -(-H // max_a)
		H = 0
	else:
		H -= B[i]
		ans += 1
	if H <= 0:
		print(ans)
		break
if H > 0:
	ans += -(-H // max_a)
	print(ans)


import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop
INPUT = lambda : sys.stdin.readline().rstrip()
INT = lambda : int(INPUT())
MAP = lambda : list(map(int, INPUT().split()))
S_MAP = lambda : list(map(str, INPUT().split()))
LIST = lambda : list(map(int, INPUT().split()))
S_LIST = lambda : list(map(str, INPUT().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	(N, H) = MAP()
	(A, B) = ([0] * N, [0] * N)
	for i in range(N):
		(A[i], B[i]) = MAP()
	MAX_A = max(A)
	B.sort(reverse=True)
	ans = 0
	for i in range(N):
		if MAX_A >= B[i]:
			ans += -(-H // MAX_A)
			print(ans)
			break
		else:
			H -= B[i]
			ans += 1
		if H <= 0:
			print(ans)
			break
	else:
		ans += -(-H // MAX_A)
		print(ans)

def __starting_point():
	main()
__starting_point()


import sys
(N, H) = map(int, input().split())
A = 0
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A = max(A, a)
	B.append(b)
B.sort(reverse=True)
ans = 0
for b in B:
	if b > A:
		H -= b
		ans += 1
	else:
		break
	if H <= 0:
		print(ans)
		sys.exit()
print((H - 1) // A + 1 + ans)


(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
am = max(A)
pop = []
for i in reversed(range(N)):
	if B[i] < am:
		B.pop(i)
		A.pop(i)
n = 0
for i in reversed(sorted(B)):
	if H <= 0:
		print(n)
		exit()
	else:
		n += 1
		H -= i
print((H - 1) // am + 1 + n)


f = lambda : [*map(int, input().split())]
(n, h) = f()
(A, B) = ([], [])
for _ in range(n):
	(a, b) = f()
	A += [a]
	B += [b]
m = max(A)
B.sort()
c = 0
while h > 0 and B and (B[-1] > m):
	h -= B.pop()
	c += 1
print(c - -h // m * (h > 0))


(N, H) = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
	(A[i], B[i]) = map(int, input().split())
a = max(A)
B.sort()
ans = 0
while len(B) > 0 and B[-1] >= a and (H > 0):
	H -= B.pop()
	ans += 1
	if H <= 0:
		print(ans)
		exit()
print(ans + -(-H // a))


import bisect
(N, H) = list(map(int, input().split()))
B = [0] * N
m = 0
for i in range(N):
	(a, b) = list(map(int, input().split()))
	B[i] = b
	m = max(m, a)
B = sorted(B)
index = bisect.bisect_left(B, m)
over = sum(B[index:])
if over >= H:
	now = 0
	i = 1
	while now < H:
		now += B[-i]
		i += 1
	print(i - 1)
else:
	H -= over
	ans = N - index
	ans += int(H / m)
	if H % m != 0:
		ans += 1
	print(ans)


(n, h) = map(int, input().split())
p = []
for i in range(n):
	(a, b) = map(int, input().split())
	p.append([a, 0])
	p.append([b, 1])
p = sorted(p, key=lambda x: -x[0])
i = 0
ans = 0
while h > 0:
	if p[i][1] == 1:
		h -= p[i][0]
		ans += 1
		i += 1
	else:
		ans -= -h // p[i][0]
		break
print(ans)


import sys
input = sys.stdin.readline
(n, h) = map(int, input().split())
(a, b) = ([0] * n, [0] * n)
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
a_max = max(a)
b_thr = []
for i in b:
	if i > a_max:
		b_thr.append(i)
b_thr.sort(reverse=True)
ans = 0
for i in b_thr:
	if h > 0:
		h -= i
		ans += 1
	else:
		print(ans)
		return
if h % a_max == 0:
	ans += h // a_max
else:
	ans += h // a_max + 1
print(ans)


(n, h) = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(n)]
AB = sorted(AB, key=lambda x: x[1])
ans = 0
a = sorted(AB)[-1][0]
for i in range(len(AB)):
	if len(AB) <= 0 or h <= 0:
		break
	b = AB.pop(-1)[1]
	h -= b if b > a else a
	ans += 1
if h > 0:
	ans += (h + a - 1) // a
print(ans)


from math import ceil
(n, h) = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
dmax = max(a)
b.sort(reverse=True)
ans = 0
for d in b:
	if h <= 0:
		print(ans)
		exit()
	if d < dmax:
		break
	h -= d
	ans += 1
if h <= 0:
	print(ans)
	exit()
print(ans + ceil(h / dmax))


import math
(n, h) = map(int, input().split(' '))
abL = [list(map(int, input().split(' '))) for _ in range(n)]
aL = []
bL = []
for (a, b) in abL:
	aL.append(a)
	bL.append(b)
aL = sorted(aL)
bL = sorted(bL)
aMax = max(aL)
ans = 0
while h != 0:
	if h <= 0:
		break
	if len(bL) == 0 or bL[-1] < aMax:
		ans += math.ceil(h / aMax)
		break
	ans += 1
	h -= bL.pop()
print(ans)


(n, h) = map(int, input().split())
power = [list(map(int, input().split())) for _ in range(n)]
maxa = sorted(power, key=lambda x: x[0], reverse=True)[0][0]
muscleb = sorted(list(filter(lambda x: x[1] >= maxa, power)), key=lambda x: x[1], reverse=True)
ans = 0
for m in muscleb:
	ans += 1
	h -= m[1]
	if h <= 0:
		print(ans)
		return
additionala = h // maxa
if h % maxa != 0:
	additionala += 1
print(additionala + ans)


(n, h) = map(int, input().split())
A = []
B = []
for i in range(n):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
A = max(A)
B.sort(reverse=True)
count = 0
for i in B:
	if A > i:
		break
	elif h > 0:
		h -= i
		count += 1
	else:
		break
if h % A == 0 and h > 0:
	print(count + h // A)
elif h % A != 0 and h > 0:
	print(count + h // A + 1)
else:
	print(count)


(n, h) = map(int, input().split())
(a, b) = ([], [])
for i in range(n):
	(j, k) = map(int, input().split())
	a.append(j)
	b.append(k)
am = max(a)
bm = []
for i in b:
	if am < i:
		bm.append(i)
if sum(bm) < h:
	print(len(bm) + (h - sum(bm) + am - 1) // am)
else:
	bm.sort()
	ans = 0
	while h > 0:
		h -= bm.pop(-1)
		ans += 1
	print(ans)


(N, H) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in [0] * N]
a = max([a for (a, b) in ab])
b = sorted([b for (_, b) in ab if b > a])[::-1]
s = sum(b)
if s >= H:
	while s >= H:
		s -= b.pop()
	ans = len(b) + 1
else:
	ans = (H - s - 1) // a + 1 + len(b)
print(ans)


(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
ans = 0
for b in B:
	if b > A[0] and H > 0:
		H -= b
		ans += 1
if H > 0:
	ans += -(-H // A[0])
print(ans)


(n, h) = list(map(int, input().split()))
b = []
t = []
for _ in range(n):
	(c, d) = list(map(int, input().split()))
	b.append(c)
	t.append(d)
b_max = max(b)
t = sorted(t)
from bisect import bisect_right
from math import ceil
index = bisect_right(t, b_max)
ans = 0
for i in range(n - 1, index - 1, -1):
	h -= t[i]
	ans += 1
	if h <= 0:
		print(ans)
		return
cnt = ceil(h / b_max)
print(ans + cnt)


(n, h) = map(int, input().split())
(a, b) = zip(*(tuple(map(int, input().split())) for _ in range(n)))
m = max(a)
c = 0
for v in sorted(b)[::-1]:
	if h <= 0 or v < m:
		break
	h -= v
	c += 1
print(c + (max(0, h) + m - 1) // m)


(n, H) = list(map(int, input().split()))
a = []
b = []
for i in range(n):
	(ai, bi) = list(map(int, input().split()))
	a.append(ai)
	b.append(bi)
ans = 0
amax = max(a)
b.sort(reverse=True)
i = 0
while H > 0:
	if i < n:
		if amax < b[i]:
			H -= b[i]
			ans += 1
			i += 1
		else:
			ans += H // amax
			if H % amax != 0:
				ans += 1
			break
	else:
		ans += H // amax
		if H % amax != 0:
			ans += 1
		break
print(ans)


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


(N, H) = map(int, input().split(' '))
a = [0] * N
b = [0] * N
for i in range(N):
	(a[i], b[i]) = map(int, input().split(' '))
a.sort(reverse=True)
b.sort(reverse=True)
c = 0
while b[c] > a[0]:
	H -= b[c]
	c += 1
	if c == len(b):
		break
	if H <= 0:
		break
if H > 0:
	if H % a[0] != 0:
		c += 1
	c += H // a[0]
print(c)


(n, h) = list(map(int, input().split()))
atk = []
ans = 0
for i in range(n):
	(a, b) = list(map(int, input().split()))
	atk.append((a, 0))
	atk.append((b, 1))
atk.sort(key=lambda x: x[0], reverse=True)
for blade in atk:
	if blade[1] == 0:
		break
	else:
		h = max(0, h - blade[0])
		ans += 1
		if h <= 0:
			break
print(ans - -h // blade[0])


(n, h) = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
max_a = max(l, key=lambda x: x[0])[0]
l = [[a, b] for (a, b) in l if b > max_a]
l.sort(key=lambda x: x[1], reverse=True)
c = 0
for (a, b) in l:
	h -= b
	c += 1
	if h <= 0:
		print(c)
		exit()
print(c + h // max_a + (h % max_a != 0))


(n, h) = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
A = max(a)
B = sorted([x for x in b if x > A], reverse=True)
cnt = 0
damage = 0
for b in B:
	cnt += 1
	damage += b
	if damage >= h:
		break
else:
	cnt += -(-(h - damage) // A)
print(cnt)


(N, H) = map(int, input().split())
A = 0
B = [0] * (N + 1)
for i in range(N):
	(a, b) = map(int, input().split())
	A = max(a, A)
	B[i] = b
B.sort(reverse=True)
cnt = 0
i = 0
while H > 0:
	if B[i] > A:
		H -= B[i]
		cnt += 1
		i += 1
	else:
		k = -(-H // A)
		H -= A * k
		cnt += k
print(cnt)


(N, H) = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(N)]
A = max((a for (a, _) in L))
B = sorted((b for (_, b) in L if b > A))
M = len(B)
while B and H > 0:
	H -= B.pop()
print(M - len(B) + max(-1, H - 1) // A + 1)


(N, H) = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
	(a[i], b[i]) = map(int, input().split())
b.sort(reverse=True)
maxa = max(a)
ans = 0
for i in range(N):
	if b[i] < maxa:
		break
	if H <= 0:
		break
	H -= b[i]
	ans += 1
if H > 0:
	ans += -(-H // maxa)
print(ans)


import bisect
(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(A, B) = map(int, input().split())
	a.append(A)
	b.append(B)
b = sorted(b)
nage = b[bisect.bisect_right(b, max(a)):]
ans = 0
for i in nage[::-1]:
	h -= i
	ans += 1
	if h <= 0:
		break
ans += max(-(-h // max(a)), 0)
print(ans)


(N, H) = map(int, input().split())
A = []
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
B.sort(reverse=True)
Amax = max(A)
cnt = 0
for b in B:
	if Amax <= b:
		H -= b
		cnt += 1
		if H <= 0:
			print(cnt)
			exit()
print((H - 1) // Amax + 1 + cnt)


(n, h) = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(reverse=True, key=lambda x: x[1])
a_max = 0
for (a, b) in ab:
	a_max = max(a, a_max)
cnt = 0
damage = 0
for (a, b) in ab:
	if damage >= h:
		print(cnt)
		exit()
	if b <= a_max:
		break
	cnt += 1
	damage += b
zan = h - damage
cnt += (zan + a_max - 1) // a_max
print(cnt)


(n, h) = list(map(int, input().split()))
A = []
B = []
for i in range(n):
	(a, b) = list(map(int, input().split()))
	A.append(a)
	B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
B = [i for i in B if i > A[0]]
ans = 0
for i in B:
	ans += 1
	h -= i
	if h <= 0:
		break
if h > 0:
	if h % A[0] == 0:
		ans += h // A[0]
	else:
		ans += h // A[0] + 1
print(ans)


(N, H) = map(int, input().split())
src = [tuple(map(int, input().split())) for i in range(N)]
maxa = max(src)[0]
ans = 0
for (a, b) in sorted(src, key=lambda x: x[1], reverse=True):
	if b <= maxa:
		break
	H -= b
	ans += 1
	if H <= 0:
		print(ans)
		exit()
ans += (H - 1) // maxa + 1
print(ans)


(N, H) = list(map(int, input().split()))
a = 0
b = [0]
for i in range(N):
	A = list(map(int, input().split()))
	a = max(a, A[0])
	b += [A[1]]
b = sorted(b)[::-1]
for i in range(N + 1):
	if H <= 0:
		break
	if b[i] > a:
		H -= b[i]
	else:
		i += int(H / a) + (0 != H % a)
		break
print(i)


(N, H) = map(int, input().split())
X = [tuple(map(int, input().split())) for i in range(N)]
A = [x[0] for x in X]
B = [x[1] for x in X]
amax = max(A)
B.sort(reverse=True)
ans = 0
for b in B:
	if H <= 0 or b <= amax:
		break
	if b > amax:
		ans += 1
		H -= b
if H <= 0:
	print(ans)
else:
	ans += (H + amax - 1) // amax
	print(ans)


(n, h) = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n)]
attack = max(AB)[0]
AB = sorted(AB, reverse=True, key=lambda x: x[1])
cnt = 0
for (i, j) in AB:
	if j >= attack:
		h -= j
		cnt += 1
	if h <= 0:
		print(cnt)
		exit()
print(cnt + h // attack if h % attack == 0 else cnt + h // attack + 1)


throw = []
blow = 0
cnt = 0
(n, h) = map(int, input().split())
for _ in range(n):
	(a, b) = map(int, input().split())
	blow = max(blow, a)
	throw.append(b)
throw.sort()
while h > 0 and throw and (throw[-1] > blow):
	h -= throw.pop()
	cnt += 1
if h > 0:
	cnt += h // blow + (h % blow > 0)
print(cnt)


import sys
import math
input = sys.stdin.readline
(n, h) = list(map(int, input().split()))
once = []
infinity = []
for i in range(n):
	(a, b) = list(map(int, input().split()))
	once.append(b)
	infinity.append(a)
once.sort(reverse=True)
pin = max(infinity)
once2 = []
for i in range(n):
	if once[i] > pin:
		once2.append(once[i])
	else:
		break
ans = 0
for i in once2:
	ans += 1
	h -= i
	if h <= 0:
		print(ans)
		return
ans += math.ceil(h / pin)
print(ans)


(n, h) = map(int, input().split())
p = []
q = []
for i in range(n):
	(a, b) = map(int, input().split())
	p.append(a)
	q.append(b)
A = max(p)
q.sort(reverse=True)
ans = 0
for i in range(n):
	ans += 1
	h -= max(q[i], A)
	if h <= 0:
		print(ans)
		exit()
ans += -(-h // A)
print(ans)


from math import ceil
(n, h) = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
b.sort()
b.reverse()
cnt = 0
ma = max(a)
for i in range(n):
	if b[i] > ma:
		h -= b[i]
		cnt += 1
	if h <= 0:
		print(cnt)
		exit()
cnt += ceil(h / ma)
print(cnt)


(N, H) = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
	(A[i], B[i]) = map(int, input().split())
a = max(A)
B.sort()
cnt = 0
for b in B[::-1]:
	if b > a:
		H -= b
		cnt += 1
		if H <= 0:
			break
if H > 0:
	cnt += (H + a - 1) // a
print(cnt)


import math
(N, H) = list(map(int, input().split()))
A = []
B = []
for i in range(N):
	(a, b) = list(map(int, input().split()))
	A.append(a)
	B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
a_max = A[0]
ans = 0
bi = 0
while H > 0:
	if bi < N and a_max <= B[bi]:
		ans += 1
		H -= B[bi]
		bi += 1
	else:
		ans += math.ceil(H / a_max)
		break
print(ans)


(n, h) = map(int, input().split())
ab = [[int(i) for i in input().split()] for _ in range(n)]
maxa = max(map(lambda x: x[0], ab))
ab.sort(key=lambda x: x[1], reverse=True)
ans = 0
for (a, b) in ab:
	if b > maxa:
		h -= b
		ans += 1
	if h <= 0:
		print(ans)
		exit(0)
print(ans + (h - 1) // maxa + 1)


(n, h) = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
a.sort()
b.sort()
b.reverse()
c = 0
for x in b:
	if x <= a[-1] or h <= 0:
		break
	h -= x
	c += 1
print(c + max(0, (h + a[-1] - 1) // a[-1]))


import math
(n, h) = map(int, input().split())
lis = [list(map(int, input().split())) for _ in range(n)]
a_sort = sorted(lis, reverse=True)
b_sort = sorted(lis, key=lambda x: x[1], reverse=True)
cnt = 0
furu = a_sort[0][0]
for nage in b_sort:
	if nage[1] > furu:
		h -= nage[1]
		cnt += 1
	else:
		break
	if h <= 0:
		break
if h <= 0:
	print(cnt)
else:
	plus = int(math.ceil(h / furu))
	cnt += plus
	print(cnt)


(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
B.append(0)
a = max(A)
B.sort()
ans = 0
while a <= B[-1] and H > 0:
	b = B.pop()
	H -= b
	ans += 1
H = max(0, H)
last = (H + a - 1) // a
ans += last
print(ans)


(n, h) = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
(a, b) = (0, [])
for j in x:
	if a < j[0]:
		a = j[0]
	b.append(j[1])
b = [i for i in b if i > a]
b.sort()
b = b[::-1]
if h <= sum(b):
	(num, i) = (0, 0)
	while h > 0:
		h -= b[i]
		num += 1
		i += 1
else:
	h -= sum(b)
	num = (h + a - 1) // a + len(b)
print(num)


(n, h) = map(int, input().split())
(A, B) = ([0] * n, [0] * n)
for i in range(n):
	(A[i], B[i]) = map(int, input().split())
A_max = max(A)
B.sort(reverse=True)
ans = 0
for i in B:
	if i > A_max:
		h -= i
		ans += 1
		if h <= 0:
			h = 0
			break
	else:
		break
if h < 0:
	h = 0
q = h / A_max
p = q % 1
ans += int(q)
if p > 0:
	print(ans + 1)
else:
	print(ans)


(N, HP) = map(int, input().split())
As = [0] * N
Bs = [0] * N
for i in range(N):
	(a, b) = map(int, input().split())
	As[i] = a
	Bs[i] = b
As.sort(reverse=True)
Bs.sort(reverse=True)
cnt = 0
for b in Bs:
	if As[0] < b:
		HP -= b
		cnt += 1
	else:
		break
	if HP <= 0:
		break
print(cnt + (HP // As[0] + (HP % As[0] != 0) if HP > 0 else 0))


(n, h) = list(map(int, input().split()))
a = [0] * n
b = [0] * n
for i in range(n):
	(ai, bi) = list(map(int, input().split()))
	a[i] = ai
	b[i] = bi
a.sort(reverse=True)
b.sort(reverse=True)
b_select = []
for i in range(n):
	if b[i] < a[0]:
		break
	else:
		b_select.append(b[i])
if sum(b_select) >= h:
	for i in range(n):
		h -= b_select[i]
		if h <= 0:
			break
	counter = i + 1
else:
	h -= sum(b_select)
	counter = len(b_select)
	counter += (h + a[0] - 1) // a[0]
print(counter)


(N, H) = map(int, input().split())
ab = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[1], reverse=True)
a_M = max([ab[i][0] for i in range(N)])
ans = 0
for (a, b) in ab:
	if b <= a_M:
		break
	H -= b
	ans += 1
	if H <= 0:
		break
if H > 0:
	ans += (H - 1) // a_M + 1
print(ans)


(n, h) = map(int, input().split())
mxa = 0
dmg = 0
cnt = 0
di = []
for i in range(n):
	(a, b) = map(int, input().split())
	di.append(b)
	if a > mxa:
		mxa = a
di.sort(reverse=True)
for j in di:
	if j >= mxa:
		dmg += j
		cnt += 1
		if dmg >= h:
			break
if dmg < h:
	cnt += (h - dmg) // mxa
	if (h - dmg) % mxa != 0:
		cnt += 1
print(cnt)


(N, H) = map(int, input().split())
A = []
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
B.sort(reverse=True)
ma = max(A)
counter = 0
for b in B:
	if b > ma:
		counter += 1
		H -= b
		if H <= 0:
			print(counter)
			exit()
	else:
		break
counter += (H - 1) // ma + 1
print(counter)


from math import ceil
(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(ai, bi) = map(int, input().split())
	a.append(ai)
	b.append(bi)
ans = 0
maxa = max(a)
b2 = sorted([i for i in b if i > maxa], reverse=True)
for k in b2:
	if h > 0:
		ans += 1
		h -= k
if h > 0:
	ans += ceil(h / maxa)
print(ans)


(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
MA = max(A)
ans = 0
B.sort()
k = -1
while B[k] > MA:
	H -= B[k]
	k -= 1
	ans += 1
	if H <= 0:
		break
	if k < -N:
		break
if H >= 0:
	ans += -(-H // MA)
print(ans)


(N, H) = map(int, input().split())
slash = 0
Throw = []
for _ in range(N):
	(a, b) = map(int, input().split())
	slash = max(slash, a)
	if b > a:
		Throw.append(b)
Throw = sorted([th for th in Throw if th > slash], reverse=True)
(dmg, cnt) = (0, 0)
for throw in Throw:
	if dmg >= H:
		break
	dmg += throw
	cnt += 1
if dmg < H:
	from math import ceil
	cnt += ceil((H - dmg) / slash)
print(cnt)


(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	AB = list(map(int, input().split()))
	A.append(AB[0])
	B.append(AB[1])
B.sort(reverse=True)
Amax = max(A)
ans = 0
for i in range(N):
	if B[i] < Amax:
		break
	H -= B[i]
	ans += 1
	if H <= 0:
		break
if H > 0:
	ans = ans + -(-H // Amax)
print(ans)


import math
(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
ans = 0
b.sort(reverse=True)
Am = max(a)
for i in range(n):
	if b[i] >= Am:
		h -= b[i]
		ans += 1
	if h <= 0:
		break
if h > 0:
	ans += math.ceil(h / Am)
print(ans)


(n, h) = map(int, input().split())
(al, bl) = ([], [])
for i in range(n):
	(a, b) = map(int, input().split())
	al.append(a)
	bl.append(b)
ma = max(al)
bl.sort()
s = 0
c = 0
for i in bl[::-1]:
	if ma >= i:
		break
	else:
		s += i
		c += 1
		if s >= h:
			break
if h > s:
	c += (h - s - 1) // ma + 1
print(c)


(n, h) = map(int, input().split())
x = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append([a, 0])
	x.append([b, 1])
x.sort(reverse=1)
i = ans = 0
while h > 0:
	if x[i][1]:
		h -= x[i][0]
		ans += 1
	else:
		ans += 0 - -h // x[i][0]
		h = 0
	i += 1
print(ans)


(n, h) = map(int, input().split())
(a, b) = ([0] * n, [0] * n)
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
a_max = max(a)
b = sorted(b, reverse=True)
b_throw = [bi for bi in b if bi > a_max]
ans = 0
for k in b_throw:
	h -= k
	ans += 1
	if h <= 0:
		break
if h > 0:
	ans += (h + a_max - 1) // a_max
print(ans)


import sys
import numpy as np
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inl = lambda : [int(x) for x in sys.stdin.readline().split()]
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))

def solve():
	(N, H) = inl()
	a = [None] * N
	b = [None] * N
	mi = None
	(ma, mb) = (0, 0)
	for i in range(N):
		(a[i], b[i]) = inl()
		if a[i] > ma:
			mi = i
			ma = a[i]
	bm = max(b[mi], a[mi])
	am = a[mi]
	bb = []
	for i in range(N):
		bb.append((b[i], i))
	bb.sort(reverse=True)
	cnt = 0
	for i in range(N):
		if H <= 0:
			break
		(x, j) = bb[i]
		debug(H, x, j)
		if x < am:
			break
		H -= x
		cnt += 1
	if H > 0:
		k = (H + am - 1) // am
		cnt += k
		H -= k * am
		assert H <= 0
	return cnt
print(solve())


(N, H) = map(int, input().split())
nage = []
a_max = 0
for i in range(N):
	(a, b) = map(int, input().split())
	a_max = max(a_max, a)
	nage.append(b)
nage.sort(reverse=True)
cnt = 0
for i in (i for i in nage if i > a_max):
	cnt += 1
	H -= i
	if H <= 0:
		print(cnt)
		exit()
cnt += -(-H // a_max)
print(cnt)


(N, H) = map(int, input().split())
ma = 0
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	ma = max(ma, a)
	B.append(b)
B = sorted([b for b in B if b > ma])
ans = 0
while H > 0 and B:
	H -= B.pop()
	ans += 1
if H > 0:
	ans += -(-H // ma)
print(ans)


(N, M) = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
X = sorted(X, key=lambda X: -X[0])
a = X[0][0]
X = sorted(X, key=lambda X: -X[1])
i = 0
count = 0
while M > 0:
	if i < N and X[i][1] > a:
		M -= X[i][1]
		i += 1
	else:
		count += -(-M // a)
		break
	count += 1
print(count)


(n, h) = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n)]
a_max = max((a for (a, b) in AB))
B = [b for (a, b) in AB if b > a_max]
B.sort(reverse=True)
ans = 0
for b in B:
	if h <= 0:
		break
	ans += 1
	h -= b
if h > 0:
	ans += (h + a_max - 1) // a_max
print(ans)


(N, H) = map(int, input().split())
l = []
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
B.sort(reverse=True)
ans = 0
n = max(A)
flag = True
for i in range(N):
	if B[i] > n:
		ans += 1
		H -= B[i]
		if H <= 0:
			flag = False
			break
	else:
		break
if flag:
	ans += H // n
	if H % n != 0:
		ans += 1
print(ans)


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


import math
(N, H) = map(int, input().split())
a_l = []
b_l = []
for _ in range(N):
	(a, b) = map(int, input().split())
	a_l.append(a)
	b_l.append(b)
a_l.sort(reverse=True)
b_l.sort(reverse=True)
ans = 0
for i in range(N):
	if a_l[0] >= b_l[i]:
		break
	else:
		ans += 1
		H = max(H - b_l[i], 0)
		if H <= 0:
			break
ans += math.ceil(H / a_l[0])
print(ans)


import math
(n, h) = map(int, input().split())
alst = []
blst = []
for _ in range(n):
	(a, b) = map(int, input().split())
	alst.append(a)
	blst.append(b)
ma = max(alst)
blst.sort(reverse=True)
ans = 0
for b in blst:
	if b < ma:
		break
	if h <= 0:
		break
	h -= b
	ans += 1
if h > 0:
	ans += math.ceil(h / ma)
print(ans)


(N, H) = [int(_) for _ in input().split()]
A = []
B = []
for _ in range(N):
	(a, b) = [int(_) for _ in input().split()]
	A.append(a)
	B.append(b)
a = max(A)
cnt = 0
for b in sorted(B, reverse=True):
	if b < a:
		break
	H -= b
	cnt += 1
	if H <= 0:
		print(cnt)
		return
cnt += H // a
if H % a != 0:
	cnt += 1
print(cnt)


(n, h) = list(map(int, input().split()))
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = list(map(int, input().split()))
a = sorted(a, reverse=True)
b = sorted(b, reverse=True)
ans = 0
i = 0
while i < n and a[0] < b[i]:
	h -= b[i]
	i += 1
	ans += 1
	if h <= 0:
		break
if h <= 0:
	print(ans)
else:
	print(ans + (h + a[0] - 1) // a[0])


import bisect
import math
(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
am = max(A)
B.sort()
idx = bisect.bisect_right(B, am)
ans = 0
for i in range(1, N - idx + 1):
	H -= B[-i]
	ans += 1
	if H <= 0:
		print(ans)
		return
print(ans + math.ceil(H / am))


(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(q, w) = map(int, input().split())
	a += [q]
	b += [w]
m = max(a)
b = [i for i in b if i >= m]
b.sort(reverse=True)
x = 0
for i in b:
	h -= i
	x += 1
	if h <= 0:
		break
if h > 0:
	x += -(-h // m)
print(x)


def LI():
	return list(map(int, input().split()))
(N, H) = LI()
amax = 0
blist = []
for _ in range(N):
	(a, b) = LI()
	amax = max(amax, a)
	blist.append(b)
blist.sort()
ans = 0
for i in range(N - 1, -1, -1):
	if blist[i] <= amax:
		break
	ans += 1
	H -= blist[i]
	if H <= 0:
		break
if H > 0:
	if H % amax == 0:
		ans += H // amax
	else:
		ans += H // amax + 1
print(ans)


import math
(n, h) = map(int, input().split())
m = 0
b = []
for _ in range(n):
	(A, B) = map(int, input().split())
	if A > m:
		m = A
	b.append(B)
b.sort()
j = n - 1
ans = 0
while True:
	if j < 0 or b[j] <= m:
		ans += math.ceil(h / m)
		break
	h -= b[j]
	j -= 1
	ans += 1
	if h <= 0:
		break
print(ans)


import math
(N, H) = map(int, input().split())
src = [tuple(map(int, input().split())) for i in range(N)]
n = max(src)[0]
src.sort(key=lambda x: x[1], reverse=True)
ans = d = 0
for (a, b) in src:
	if b <= n:
		break
	d += b
	ans += 1
	if d >= H:
		print(ans)
		exit()
ans += math.ceil((H - d) / n)
print(ans)


(n, h) = map(int, input().split())
al = []
bl = []
for _ in [0] * n:
	(a, b) = map(int, input().split())
	al.append(a)
	bl.append(b)
al.sort()
bl.sort()
ans = 0
while h > 0:
	if len(bl) > 0 and bl[-1] > al[-1]:
		h -= bl[-1]
		ans += 1
		del bl[-1]
	else:
		ans += -(-h // al[-1])
		h = 0
print(ans)


(N, H) = list(map(int, input().split()))
A = []
B = []
for i in range(N):
	(a, b) = list(map(int, input().split()))
	A.append(a)
	B.append(b)
A = sorted(A)[::-1]
B = sorted(B)[::-1]
ret = 0
if B[0] < A[0]:
	if H % A[0] == 0:
		ret = H // A[0]
	else:
		ret = H // A[0] + 1
	H = 0
else:
	for b in B:
		if b < A[0]:
			if H % A[0] == 0:
				ret += H // A[0]
			else:
				ret += H // A[0] + 1
			H = 0
			break
		else:
			ret += 1
			H -= b
		if H <= 0:
			break
	if H > 0:
		if H % A[0] == 0:
			ret += H // A[0]
		else:
			ret += H // A[0] + 1
print(ret)


import math
(n, h) = map(int, input().split())
ab = [None] * n
for i in range(n):
	ab[i] = tuple(map(int, input().split()))
amax = max([m[0] for m in ab])
ans = 0
for (a, b) in sorted(ab, key=lambda m: -m[1]):
	if b <= amax:
		break
	h -= b
	ans += 1
	if h <= 0:
		print(ans)
		return
ans += math.ceil(h / amax)
print(ans)


(N, H) = list(map(int, input().split()))
A = 0
B = []
for i in range(N):
	(a, b) = list(map(int, input().split()))
	A = max(A, a)
	B.append(b)
B = sorted(B, reverse=True) + [0]
i = 0
while B[i] >= A:
	i += 1
B = B[:i]
ans = 0
for i in range(len(B)):
	H -= B[i]
	ans += 1
	if H <= 0:
		print(ans)
		return
print(ans + (H - 1) // A + 1)


(N, H) = map(int, input().split())
B = []
a_max = 0
for i in range(N):
	(a, b) = map(int, input().split())
	a_max = max(a_max, a)
	B.append(b)
B = sorted([b for b in B if b > a_max], reverse=True)
cnt = 0
for b in B:
	H -= b
	cnt += 1
	if H <= 0:
		break
if H > 0:
	cnt += (H - 1) // a_max + 1
print(cnt)


from math import ceil
(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
A.sort()
B.sort()
ans = 0
for i in B[::-1]:
	if i < A[-1]:
		break
	H -= i
	ans += 1
	if H <= 0:
		print(ans)
		quit()
ans += ceil(H / A[-1])
print(ans)


from math import ceil
(N, H) = map(int, input().split())
(a, b) = ([0] * N, [0] * N)
for i in range(N):
	(a[i], b[i]) = map(int, input().split())
a = max(a)
b.sort(reverse=True)
ans = 0
atk = 0
for i in range(N):
	if a >= b[i] or atk >= H:
		break
	ans += 1
	atk += b[i]
if atk < H:
	ans += ceil((H - atk) / a)
print(ans)


import math
(n, h) = map(int, input().split())
(a, b) = (0, [])
for i in range(n):
	(k, l) = map(int, input().split())
	a = max(a, k)
	b.append(l)
b.sort(reverse=True)
cnt = 0
idx = 0
while h > 0:
	if idx < len(b) and b[idx] > a:
		h -= b[idx]
		idx += 1
		cnt += 1
	else:
		cnt += math.ceil(h / a)
		h = 0
print(cnt)


(n, h) = map(int, input().split())
a = []
b = []
for _ in range(n):
	(tmp_a, tmp_b) = map(int, input().split())
	a.append(tmp_a)
	b.append(tmp_b)
v = max(a)
b.sort(reverse=True)
i = 0
while i < n and b[i] > v and (h > 0):
	h -= b[i]
	i += 1
if h <= 0:
	print(i)
else:
	print(i + (h + v - 1) // v)


(n, h) = map(int, input().split())
abl = [list(map(int, input().split())) for nesya in range(n)]
abl.sort()
amax = abl[-1][0]
b_list = []
for ab in abl:
	b = ab[1]
	if amax <= b:
		b_list.append(b)
b_list.sort()
ans = 0
for num in b_list[::-1]:
	h -= num
	ans += 1
	if h <= 0:
		print(ans)
		return
if h % amax == 0:
	print(ans + h // amax)
else:
	print(ans + h // amax + 1)


from math import ceil
(N, H) = map(int, input().split())
(A, B) = (0, [])
for i in range(N):
	(a, b) = map(int, input().split())
	A = max(A, a)
	B.append(b)
B = [b for b in B if b > A]
B.sort()
ans = 0
while H > 0 and B:
	ans += 1
	H -= B.pop()
H = max(0, H)
ans += ceil(H / A)
print(ans)


(n, h) = map(int, input().split())
ab = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[1], reverse=True)
m = max([i[0] for i in ab])
ans = 0
for i in ab:
	if i[1] > m:
		h -= i[1]
		ans += 1
		if h <= 0:
			print(ans)
			exit()
if h % m == 0:
	print(ans + h // m)
else:
	print(ans + h // m + 1)


(n, h) = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
ab = sorted(a + b)[::-1]
ans = 0
for i in ab[:ab.index(max(a))]:
	h -= i
	ans += 1
	if h <= 0:
		print(ans)
		exit()
ans += (h + max(a) - 1) // max(a)
print(ans)


import math
(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
ans = 0
B.sort(reverse=True)
Am = max(A)
for i in range(N):
	if B[i] >= Am:
		H -= B[i]
		ans += 1
	if H <= 0:
		break
if H > 0:
	ans += math.ceil(H / Am)
print(ans)


(N, H) = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1], reverse=True)
a_max = 0
for i in range(N):
	a_max = max(a_max, AB[i][0])
cnt = 0
sum_throw = 0
for i in range(N):
	if AB[i][1] > a_max:
		sum_throw += AB[i][1]
		cnt += 1
		if sum_throw >= H:
			print(cnt)
			return
rem = H - sum_throw
(q, r) = divmod(rem, a_max)
if r == 0:
	cnt += q
else:
	cnt += q + 1
print(cnt)


(n, h) = map(int, input().split())
A = list((tuple(map(int, input().split())) for i in range(n)))
(A, B) = zip(*A)
a = max(A)
count = 0
for i in sorted(B)[::-1]:
	if h <= 0:
		break
	elif i >= a:
		count += 1
		h -= i
if h > 0:
	count += (h - 1) // a + 1
print(count)


(N, H) = map(int, input().split())
a = 0
b = []
for _ in range(N):
	(A, B) = map(int, input().split())
	a = max(a, A)
	b.append(B)
b = sorted(b, reverse=True)
ans = 0
for i in range(N):
	if b[i] <= a:
		break
	H -= b[i]
	ans += 1
	if H <= 0:
		print(ans)
		exit()
print(ans - -H // a)


(n, h) = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(n)]
a = max([l[0] for l in ls])
bs = [l[1] for l in ls if l[1] > a]
bs.sort()
res = 0
while h > 0 and len(bs) > 0:
	h -= bs.pop()
	res += 1
if h > 0:
	res += (h + a - 1) // a
print(res)


import sys
input = sys.stdin.readline
(N, H) = map(int, input().split())
katanas = []
for _ in range(N):
	(a, b) = map(int, input().split())
	katanas.append((a, b))
max_a = sorted(katanas, reverse=True)[0][0]
throws = []
for (a, b) in katanas:
	if max_a < b:
		throws.append(b)
ans = 0
for b in sorted(throws, reverse=True):
	H -= b
	ans += 1
	if H <= 0:
		print(ans)
		return
print(ans + (H - 1) // max_a + 1)


(n, h) = list(map(int, input().split()))
wield = 0
bs = []
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a > wield:
		wield = a
	bs.append(b)
throw = []
for i in range(n):
	if bs[i] > wield:
		throw.append(bs[i])
total = sum(throw)
if total > h:
	throw = sorted(throw, reverse=True)
	total = 0
	ind = 0
	while total < h:
		total += throw[ind]
		ind += 1
	print(ind)
else:
	print((h - total + wield - 1) // wield + len(throw))


f = lambda : map(int, input().split())
(n, h) = f()
(mA, B) = (0, [])
for _ in range(n):
	(a, b) = f()
	mA = max(mA, a)
	B.append(b)
B = sorted([i for i in B if i > mA], reverse=True)
ans = 0
while h > 0:
	if not B:
		ans += -(-h // mA)
		break
	else:
		h -= B[0]
		B.pop(0)
		ans += 1
print(ans)


def resolve():
	(N, H) = [int(item) for item in input().split()]
	ab = [[int(item) for item in input().split()] for _ in range(N)]
	ab.sort(reverse=True, key=lambda x: x[1])
	a_max_ab = max(ab, key=lambda x: x[0])
	cnt = 0
	for (a, b) in ab:
		if b > a_max_ab[0]:
			H -= b
			cnt += 1
		if H <= 0:
			break
	if H > 0:
		cnt += H // a_max_ab[0]
		if H % a_max_ab[0] != 0:
			cnt += 1
	print(cnt)

def __starting_point():
	resolve()
__starting_point()


(N, H) = list(map(int, input().split()))
A = []
B = []
for i in range(N):
	(a, b) = list(map(int, input().split()))
	A.append(a)
	B.append(b)
A_sorted = sorted(A, reverse=True)
B_sorted = sorted(B, reverse=True)
ans = 0
attack_sum = 0
for i in range(N):
	if B_sorted[i] >= A_sorted[0]:
		if H > attack_sum:
			attack_sum += B_sorted[i]
			ans += 1
		else:
			print(ans)
			return
	else:
		break
ans += -(-(H - attack_sum) // A_sorted[0])
print(ans)


import math
(N, H) = list(map(int, input().split()))
swing = []
throw = []
for _ in range(N):
	(sw, th) = list(map(int, input().split()))
	swing.append(sw)
	throw.append(th)
swing.sort(reverse=True)
throw.sort(reverse=True)
if swing[0] >= throw[0]:
	print(math.ceil(H / swing[0]))
else:
	cnt = 0
	damage_sum = 0
	while cnt < len(throw):
		if throw[cnt] <= swing[0]:
			break
		damage_sum += throw[cnt]
		cnt += 1
		if damage_sum >= H:
			print(cnt)
			return
	print(math.ceil(cnt + (H - damage_sum) / swing[0]))


(N, H) = map(int, input().split())
slash = 0
Throw = []
for _ in range(N):
	(a, b) = map(int, input().split())
	slash = max(slash, a)
	if b > a:
		Throw.append(b)
import heapq as hq
Throw = [-th for th in Throw if th > slash]
hq.heapify(Throw)
(dmg, cnt) = (0, 0)
while len(Throw) != 0:
	if dmg >= H:
		break
	dmg += -hq.heappop(Throw)
	cnt += 1
if dmg < H:
	from math import ceil
	cnt += ceil((H - dmg) / slash)
print(cnt)


from heapq import heappop, heappush
(N, H) = map(int, input().split())
a = [None] * N
b = [None] * N
for i in range(N):
	(a[i], b[i]) = map(int, input().split())
a.sort()
b.sort()
q = []
for i in range(N):
	if b[i] > a[-1]:
		heappush(q, -b[i])
ans = 0
while q:
	H += heappop(q)
	ans += 1
	if H <= 0:
		print(ans)
		return
print(ans + (H + a[-1] - 1) // a[-1])


import sys
import math
(n, h) = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
a = [ab[i][0] for i in range(n)]
A = max(a)
b = [ab[i][1] for i in range(n) if ab[i][1] > A]
b = sorted(b, reverse=True)
cnt = 0
for i in b:
	h -= i
	cnt += 1
	if h <= 0:
		print(cnt)
		sys.exit()
print(cnt + math.ceil(h / A))


(n, h) = map(int, input().split())
an = [0] * n
bn = [0] * n
for i in range(n):
	(an[i], bn[i]) = map(int, input().split())
an.sort(reverse=True)
bn.sort(reverse=True)
ans = 0
for b in bn:
	if b > an[0] and h > 0:
		h -= b
		ans += 1
ans += 0 if h <= 0 else h // an[0] + (1 if h % an[0] > 0 else 0)
print(ans)


import math
(N, H) = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
	(A[i], B[i]) = map(int, input().split())
B = sorted(B, reverse=True)
maxa = max(A)
ans = 0
for b in B:
	if b < maxa:
		break
	ans += 1
	H -= b
	if H <= 0:
		break
H = max(0, H)
ans += math.ceil(H / maxa)
print(ans)


(N, H) = map(int, input().split())
A = []
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)

def solver(N, H, A, B):
	x = max(A)
	B.sort()
	B.reverse()
	ans = 0
	for b in B:
		if b < x:
			break
		H -= b
		ans += 1
		if H <= 0:
			return ans
	return ans + -(-H // x)
print(solver(N, H, A, B))


from bisect import bisect_left, bisect
import sys
(n, h) = list(map(int, input().split()))
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = list(map(int, input().split()))
amax = max(a)
b.sort()
ii = bisect(b, amax)
b = b[ii:]
b.reverse()
icnt = 0
for bi in b:
	icnt += 1
	h = h - bi
	if h <= 0:
		print(icnt)
		return
di = (h - 1) // amax + 1
print(icnt + di)


(n, h) = map(int, input().split())
x = [0] * n
y = 0
for i in range(n):
	(a, b) = map(int, input().split())
	y = max(y, a)
	x[i] = b
cnt = 0
x.sort(reverse=1)
for i in x:
	if i > y:
		cnt += 1
		h -= i
	if h <= 0:
		print(cnt)
		exit()
print(cnt + (h + y - 1) // y)


(N, H) = list(map(int, input().split()))
B = []
A = 0
for _ in range(N):
	(a, b) = list(map(int, input().split()))
	A = max(A, a)
	B.append(b)
B.sort(reverse=True)
ans = (H - 1) // A + 1
for i in range(N):
	H -= B[i]
	if H <= 0:
		ans = min(ans, i + 1)
		break
	ans = min(ans, (H - 1) // A + 1 + i + 1)
print(ans)


(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
max_a = max(a)
ans = 0
for x in reversed(sorted(filter(lambda x: x >= max_a, b))):
	h -= x
	ans += 1
	if h <= 0:
		break
ans += max(0, (h + max_a - 1) // max_a)
print(ans)


f = lambda : [*map(int, input().split())]
(n, h) = f()
(A, B) = ([], [])
for _ in range(n):
	(a, b) = f()
	A += [a]
	B += [b]
m = max(A)
B.sort()
c = 0
for b in sorted(B)[::-1]:
	if b > m:
		h -= b
		c += 1
		if h < 1:
			break
print(c - -h // m * (h > 0))


(n, h) = map(int, input().split())
alst = []
blst = []
for _ in range(n):
	(a, b) = map(int, input().split())
	alst.append(a)
	blst.append(b)
blst.sort(reverse=True)
a = max(alst)
ans = 0
for num in blst:
	if num < a:
		ans += (h - 1) // a + 1
		break
	else:
		ans += 1
		h -= num
		if h <= 0:
			break
else:
	ans += (h - 1) // a + 1
print(ans)


(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
a.sort()
b.sort()
chk = max(a)
ans = 0
for i in b[::-1]:
	if h <= 0 or i < chk:
		break
	ans += 1
	h -= i
if h > 0:
	ans += (h + chk - 1) // chk
print(ans)


import math
(N, H) = map(int, input().split())
ab = [[int(x) for x in input().split()] for _ in range(N)]
(a, _) = max(ab)
B = sorted([b for (_, b) in ab if b > a], reverse=True)
sb = sum(B)
if sb < H:
	print(len(B) + math.ceil((H - sb) / a))
else:
	B.insert(0, 0)
	for i in range(1, len(B)):
		B[i] += B[i - 1]
		if B[i] >= H:
			break
	print(i)


from heapq import *
(n, h) = map(int, input().split())
k = []
for _ in [0] * n:
	(a, b) = map(int, input().split())
	heappush(k, (-a, 1))
	heappush(k, (-b, 0))
ans = 0
while h > 0:
	(a, i) = heappop(k)
	a = -a
	if i:
		ans += (h + a - 1) // a
		break
	else:
		ans += 1
		h -= a
print(ans)


(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
B.sort(reverse=True)
amax = max(A)
ans = 0
l = 0
for b in B:
	if l >= H:
		print(ans)
		exit()
	if b > amax:
		ans += 1
		l += b
	else:
		break
ans += (H - l) // amax + min((H - l) % amax, 1)
print(ans)


import heapq as hq
from math import ceil
(N, H) = map(int, input().split())
A = 0
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A = max(A, a)
	hq.heappush(B, -b)
ans = 0
while H > 0 and B:
	b = -hq.heappop(B)
	if b > A:
		H -= b
		ans += 1
	else:
		break
if H > 0:
	ans += ceil(H / A)
print(ans)


import math
(n, h) = map(int, input().split())
a_l = []
b_l = []
c = 0
for i in range(n):
	(a, b) = map(int, input().split())
	a_l.append(a)
	b_l.append(b)
a_l.sort()
b_l.sort()
for i in range(1, n + 1):
	if a_l[-1] <= b_l[-1 * i]:
		h -= b_l[-1 * i]
		c += 1
		if h <= 0:
			break
	else:
		break
if h > 0:
	c += math.ceil(h / a_l[-1])
print(c)


from bisect import bisect_right
(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(a1, b1) = map(int, input().split())
	a.append(a1)
	b.append(b1)
a_s = sorted(a, reverse=1)
b_s1 = sorted(b)
b_s = sorted(list(b_s1[bisect_right(b_s1, a_s[0]):]), reverse=1)
count = 0
sum = 0
for j in b_s:
	sum += j
	count += 1
	if h <= sum:
		print(count)
		break
else:
	if (h - sum) % a_s[0] == 0:
		print(count + (h - sum) // a_s[0])
	else:
		print(count + 1 + (h - sum) // a_s[0])


import sys
(N, H) = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
	(a, b) = map(int, input().split())
	(A[i], B[i]) = (a, b)
max_A = max(A)
B.sort(reverse=True)
K = 0
for b in B:
	if H > 0 and b >= max_A:
		K += 1
		H -= b
if H > 0:
	K += (H + max_A - 1) // max_A
print(K)


(n, h) = map(int, input().split())
(a, b) = ([], [])
for i in range(n):
	(c, d) = map(int, input().split())
	a.append(c)
	b.append(d)
a_max = max(a)
b = sorted(b, reverse=True)
piv = 0
res = 0
while h > 0 and piv < n and (b[piv] > a_max):
	res += 1
	h -= b[piv]
	piv += 1
if h > 0:
	res += (h + a_max - 1) // a_max
print(res)


(N, H) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
ab.sort()
M = ab[-1][0]
B = [b for (a, b) in ab]
B.sort()
B = B[::-1]
ans = 0
for b in B:
	if H > 0 and b > M:
		H -= b
		ans += 1
	else:
		break
ans += 0 - -max(0, H) // M
print(ans)


(n, h) = map(int, input().split())
list_AB = [list(map(int, input().split(' '))) for _ in range(n)]
cnt = 0
A = 0
for (a, b) in list_AB:
	A = max(A, a)
list_AB.sort(key=lambda x: x[1], reverse=True)
for (a, b) in list_AB:
	if b > A:
		h -= b
		cnt += 1
	if h <= 0:
		break
if h > 0:
	if h % A == 0:
		cnt += h // A
	else:
		cnt += h // A + 1
print(cnt)


3
(N, H) = (int(x) for x in input().split())
A = []
B = []
for i in range(N):
	(a, b) = (int(x) for x in input().split())
	A.append(a)
	B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
ret = 0
AMax = A[0]
for b in B:
	if b < AMax or H <= 0:
		break
	H -= b
	ret += 1
if H > 0:
	ret += H // AMax
	if H % AMax != 0:
		ret += 1
print(ret)


(N, H) = map(int, input().split())
a_max = 0
b_list = []
count = 0
for _ in range(N):
	(a, b) = map(int, input().split())
	a_max = max(a, a_max)
	b_list.append(b)
b_list.sort(reverse=True)
for b in b_list:
	if b > a_max:
		H -= b
		count += 1
	else:
		break
	if H <= 0:
		print(count)
		exit()
print((H - 1) // a_max + 1 + count)


(N, H) = map(int, input().split())
A = [list(map(int, input().split())) for i in range(N)]
B = []
C = []
for (a, b) in A:
	B.append(a)
	C.append(b)
D = sorted(B)[::-1]
b = D[0]
F = []
for i in C:
	if b < i:
		F.append(i)
G = sorted(F)[::-1]
cnt = 0
for i in G:
	H -= i
	cnt += 1
	if H <= 0:
		print(cnt)
		exit()
print(cnt - -H // b)


import math
(n, h) = map(int, input().split())
(a, b) = ([0] * n, [0] * n)
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
amax = max(a)
cnt = 0
for bi in sorted(b, reverse=True):
	if bi < amax:
		break
	cnt += 1
	h -= bi
	if h <= 0:
		break
if h > 0:
	cnt += math.ceil(h / amax)
print(cnt)


import math
(n, h) = map(int, input().split())
(a, b) = zip(*(map(int, input().split()) for _ in range(n)))
m = max(a)
r = 0
for i in sorted(b)[::-1]:
	if h <= 0 or i <= m:
		break
	h -= i
	r += 1
print(r + math.ceil(max(h, 0) / m))


(n, h) = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
(A, B) = zip(*l)
max_a = max(A)
c = 0
for b in sorted([b for b in B if b > max_a], reverse=True):
	h -= b
	c += 1
	if h <= 0:
		print(c)
		exit()
print(c + h // max_a + (h % max_a != 0))


import bisect
import math
(N, H) = list(map(int, input().split()))
swing = []
throw = []
for _ in range(N):
	(sw, th) = list(map(int, input().split()))
	swing.append(sw)
	throw.append(th)
swing.sort(reverse=True)
throw.sort()
idx = bisect.bisect_right(throw, swing[0])
if idx == len(throw):
	print(math.ceil(H / swing[0]))
else:
	throw = throw[idx:]
	cnt = 0
	damage_sum = 0
	for i in reversed(throw):
		cnt += 1
		damage_sum += i
		if damage_sum >= H:
			print(cnt)
			return
	print(math.ceil(cnt + (H - damage_sum) / swing[0]))


(N, H) = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]
a = max([i[0] for i in AB])
B = sorted([i[1] for i in AB if i[1] > a], reverse=True)
count = 0
for b in B:
	H -= b
	count += 1
	if H <= 0:
		break
if H > 0:
	count += H // a + 1 * (H % a > 0)
print(count)


def i2():
	return [int(i) for i in input().split()]
[n, h] = i2()
a = []
for i in range(n):
	b = i2()
	a += [[b[0], 0], [b[1], 1]]
a.sort()
a = a[::-1]
i = 0
c = 0
while a[i][1] == 1 and h > 0:
	h -= a[i][0]
	c += 1
	i += 1
if h > 0:
	c += h // a[i][0]
	if h % a[i][0]:
		c += 1
print(c)


from math import ceil
(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(A, B) = map(int, input().split())
	a.append(A)
	b.append(B)
ma = max(a)
mb = [i for i in b if i > ma]
mb.sort(reverse=True)
if sum(mb) >= h:
	i = 0
	while h > 0:
		h -= mb[i]
		i += 1
	print(i)
else:
	cnt = len(mb)
	h -= sum(mb)
	print(cnt + ceil(h / ma))


(n, h) = map(int, input().split())
amax = 0
bs = []
for i in range(n):
	(a, b) = map(int, input().split())
	amax = max(amax, a)
	bs.append(b)
bs = sorted([i for i in bs if i >= amax], reverse=True)
ans = 0
for i in bs:
	h -= i
	ans += 1
	if h <= 0:
		break
else:
	ans += (h + amax - 1) // amax
print(ans)


(N, H) = map(int, input().split())
(A, B) = ([0] * N, [0] * N)
for i in range(N):
	(A[i], B[i]) = map(int, input().split())
target = max(A)
ans = 0
B.sort(reverse=True)
for i in B:
	if i >= target:
		H -= i
		ans += 1
	if H <= 0:
		print(ans)
		exit()
print(ans - -H // target)


(N, M) = map(int, input().split())
(X, Y) = ([], [])
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
mx = max(X)
Y.sort()
r = 0
for y in Y[::-1]:
	if y < mx:
		break
	r += 1
	M -= y
	if M <= 0:
		break
if M > 0:
	r += -(-M // mx)
print(r)


(N, H) = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
	(a[i], b[i]) = map(int, input().split())
a_max = max(a)
ans = dmg = 0
for dmg_i in sorted([bi for bi in b if bi > a_max], reverse=True):
	dmg += dmg_i
	ans += 1
	if dmg >= H:
		print(ans)
		break
else:
	print(ans + (H - dmg + a_max - 1) // a_max)


from bisect import bisect_left
(N, H) = map(int, input().split())
amax = 0
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	if a > amax:
		amax = a
	B.append(b)
B = sorted(B)
idx = bisect_left(B, amax)
B = B[idx:][::-1]
cum = [0]
for i in range(len(B)):
	cum += [cum[-1] + B[i]]
	if cum[-1] >= H:
		print(i + 1)
		return
print(len(B) + (H - cum[-1] + amax - 1) // amax)


import math
(N, H) = map(int, input().split())
A = []
r = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A.append([a, 0])
	A.append([b, 1])
A.sort()
ans = 0
while H > 0:
	p = A.pop()
	if p[1] == 1:
		H -= p[0]
		ans += 1
	else:
		ans += math.ceil(H / p[0])
		break
print(ans)


(n, h) = map(int, input().split())
a = []
b = []
ans = 0
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
b.sort(reverse=True)
c = max(a)
for i in b:
	if i > c:
		h -= i
		ans += 1
		if h <= 0:
			print(ans)
			exit()
ans += (h + c - 1) // c
print(ans)


(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
count = 0
for b in B:
	if b > A[0]:
		H -= b
		count += 1
	else:
		break
	if H <= 0:
		break
if H > 0:
	count += (H + A[0] - 1) // A[0]
print(count)


(n, h) = map(int, input().split())
(A, B) = ([0] * n, [0] * n)
for i in range(n):
	(A[i], B[i]) = map(int, input().split())
maxa = max(A)
(c, d) = (0, 0)
for i in sorted(B)[::-1]:
	if i > maxa:
		c += i
		d += 1
		if c >= h:
			print(d)
			exit()
ans = d - (c - h) // maxa
print(ans)


(N, H) = map(int, input().split())
src = [tuple(map(int, input().split())) for i in range(N)]
maxa = 0
bs = []
for (a, b) in src:
	maxa = max(maxa, a)
	bs.append(b)
bs.sort()
ans = 0
while bs:
	b = bs.pop()
	if b <= maxa:
		break
	H -= b
	ans += 1
	if H <= 0:
		print(ans)
		exit()
ans += -(-H // maxa)
print(ans)


import math
(n, h) = map(int, input().split())
katana = []
a_max = 0
for i in range(n):
	ab = list(map(int, input().split()))
	katana.append(ab)
	a_max = max(a_max, ab[0])
katana = sorted(katana, key=lambda x: x[1], reverse=True)
life = h
count = 0
for (a, b) in katana:
	if b <= a_max:
		break
	else:
		life -= b
	count += 1
	if life <= 0:
		break
if life > 0:
	count += math.ceil(life / a_max)
print(count)


from math import ceil
(N, H) = map(int, input().split())
B = []
a = 0
for i in range(N):
	(aa, b) = map(int, input().split())
	if a < aa:
		a = aa
	B.append(b)
B.sort(reverse=True)
res = 0
for b in B:
	if a < b:
		H -= b
	else:
		break
	res += 1
	if H <= 0:
		break
if H <= 0:
	print(res)
else:
	print(res + ceil(H / a))


from math import ceil
(n, h) = map(int, input().split())
a = []
b = []
for i in range(n):
	(p, q) = map(int, input().split())
	a.append(p)
	b.append(q)
b.sort(reverse=1)
ans = 0
m = max(a)
for i in b:
	if i < m or h <= 0:
		break
	h -= i
	ans += 1
if h > 0:
	ans += ceil(h / m)
print(ans)


(n, h) = map(int, input().split())
(a, b) = ([], [])
for i in range(n):
	inp = list(map(int, input().split()))
	a.append(inp[0])
	b.append(inp[1])
am = max(a)
b.sort()
b.reverse()
c = 0
for i in b:
	if i < am:
		break
	c += 1
	h -= i
	if h <= 0:
		break
c += max((h - 1) // am + 1, 0)
print(c)


import sys
(n, h) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
l.sort()
x = l[-1][0]
L = []
for i in range(n):
	if l[i][1] > x:
		L.append(l[i][1])
L.sort()
L.reverse()
ct = 0
for i in range(len(L)):
	h -= L[i]
	ct += 1
	if h <= 0:
		print(ct)
		sys.exit()
print(ct + (h + x - 1) // x)


(N, H) = map(int, input().split())
K = [list(map(int, input().split())) for n in range(N)]
A = max((k[0] for k in K))
B = sorted((b for (a, b) in K if A < b))
C = 0
while 0 < H and B:
	H -= B.pop()
	C += 1
print(C - -max(0, H) // A)


(n, h) = map(int, input().split())
(A, B) = ([], [])
for _ in range(n):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
a = max(A)
B = sorted(list(filter(lambda x: x > a, B)), reverse=True)
ans = 0
while h > 0 and B:
	h -= B[0]
	B.pop(0)
	ans += 1
if h > 0:
	if h % a == 0:
		ans += h // a
	else:
		ans += h // a + 1
print(ans)


import math
(n, h) = map(int, input().split())
A = 0
b = []
ans = 0
for _ in range(n):
	(u, v) = map(int, input().split())
	A = max(A, u)
	b.append(v)
for B in sorted(b, key=lambda x: -x):
	if h <= 0 or B <= A:
		break
	h -= B
	ans += 1
print(max(0, math.ceil(h / A)) + ans)


(n, h) = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
a_max = max(a)
b.sort()
ans = 0
for bi in b[::-1]:
	if bi > a_max and h > 0:
		h -= bi
		ans += 1
	else:
		break
if h > 0:
	ans += -(-h // a_max)
print(ans)


(N, H) = map(int, input().split())
Ma = 1
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	B.append(b)
	if a > Ma:
		Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma and H > 0:
	i += 1
	H -= Mb
	if i == N:
		Mb = 0
	else:
		Mb = B[i]
if H <= 0:
	print(i)
else:
	print(i + int(-(-H // Ma)))


(N, H) = map(int, input().split())
bs = []
maxA = 0
ans = 0
for _ in range(N):
	(a, b) = map(int, input().split())
	maxA = max(maxA, a)
	bs.append(b)
bs.sort(reverse=True)
for b in bs:
	if H <= 0:
		break
	if b > maxA:
		H -= b
		ans += 1
if H > 0:
	ans += -(-H // maxA)
print(ans)


(n, h) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
c = max([a[0] for a in ab])
d = [b[1] for b in ab if b[1] > c]
d.sort()
ans = 0
while len(d) > 0:
	h -= d.pop()
	ans += 1
	if h <= 0:
		print(ans)
		exit()
f = (h + c - 1) // c
print(ans + f)


(N, H) = list(map(int, input().split()))
A = [0] * N
B = [0] * N
for i in range(N):
	(a, b) = list(map(int, input().split()))
	(A[i], B[i]) = (a, b)
a = max(A)
T = 0
ct = 0
B = reversed(sorted(B))
for b in B:
	if b > a:
		ct += 1
		T += b
	if T >= H:
		break
print(ct + max((H - T + a - 1) // a, 0))


(n, h) = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(n)]
th = max(l, key=lambda x: x[0])[0]
l = sorted([i for i in l if i[1] >= th], key=lambda x: -x[1])
(c, v) = (0, 0)
for i in l:
	if v < h:
		v += i[1]
		c += 1
if v < h:
	(a, b) = divmod(h - v, th)
	if b:
		a += 1
	c += a
print(c)


from math import ceil
(N, H) = map(int, input().split())
A = []
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
else:
	a = max(A)
	B.sort()
	B.reverse()
ans = 0
for b in B:
	if H <= 0:
		print(ans)
		break
	if a < b:
		H -= b
		ans += 1
else:
	print(ans + ceil(H / a))


from math import ceil
(n, h) = map(int, input().split())
(A, B) = ([], [])
for _ in range(n):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
a = max(A)
B = sorted(list(filter(lambda x: x > a, B)), reverse=True)
ans = 0
i = 0
l = len(B)
while h > 0 and i < l:
	h -= B[i]
	ans += 1
	i += 1
if h > 0:
	ans += ceil(h / a)
print(ans)


(n, h) = map(int, input().split())
a = 0
b = []
for i in range(n):
	(A, B) = map(int, input().split())
	a = max(A, a)
	b.append(B)
b = sorted(b)[::-1]
for i in range(n):
	if 0 < h and a < b[i]:
		h -= b[i]
		ans = i + 1
	else:
		ans = i
		break
if 0 < h:
	ans += -(-h // a)
print(ans)


(N, H) = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
	(a[i], b[i]) = map(int, input().split())
a_max = max(a)
b.sort(reverse=True)
c = 0
for i in range(N):
	if b[i] > a_max:
		H -= b[i]
		c += 1
	if H <= 0:
		break
if H > 0:
	c += (H + a_max - 1) // a_max
print(c)


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

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

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]
import string

def main():
	(N, H) = i_map()
	l = []
	for _ in range(N):
		(a, b) = i_map()
		l.append([a, b])
	t = [list(i) for i in zip(*l)]
	ans = 0
	M = max(t[0])
	throw = 0
	for i in sorted(t[1], reverse=True):
		if i > M:
			throw += i
			H -= i
			ans += 1
			if H <= 0:
				print(ans)
				return
	i = t[0].index(M)
	if H % M == 0:
		ans += H // M
	else:
		ans += H // M + 1
	print(ans)

def __starting_point():
	main()
__starting_point()


(n, h) = map(int, input().split())
x = (tuple(map(int, input().split())) for _ in [0] * n)
(a2, b) = ([], [])
for j in x:
	a2.append(j[0])
	b.append(j[1])
a = max(a2)
b = [i for i in b if i > a]
b.sort()
b = b[::-1]
if h <= sum(b):
	(num, i) = (0, 0)
	while h > 0:
		h -= b[i]
		num += 1
		i += 1
else:
	h -= sum(b)
	num = (h + a - 1) // a + len(b)
print(num)


(N, H) = map(int, input().split())
(A, B) = zip(*[tuple(map(int, input().split())) for _ in range(N)])
a = max(A)
B = sorted((b for b in B if b > a), reverse=True)
for (i, b) in enumerate(B, 1):
	H -= b
	if H <= 0:
		ans = i
		break
else:
	ans = len(B) + (H + a - 1) // a
print(ans)


(N, H) = map(int, input().split())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A += [a]
	B += [b]
A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = A[0]
count = 0
for i in range(N):
	if B[i] >= C:
		H -= B[i]
		count += 1
		if H <= 0:
			print(count)
			exit()
answer = count - -H // C
print(answer)


(N, H) = map(int, input().split())
A = []
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
max_a = max(A)
B.sort(key=lambda b: -b)
ans = 0
for b in B:
	if b < max_a:
		break
	H -= b
	ans += 1
	if H <= 0:
		print(ans)
		return
ans += (H - 1) // max_a + 1
print(ans)


(N, H) = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
ab = list(zip(*ab))
a = sorted(ab[0], reverse=True)
b = sorted(ab[1], reverse=True)
amax = a[0]
bc = 0
ans = 0
flag = True
while H > 0 and flag:
	bmax = b[bc]
	if bmax > amax:
		H -= bmax
		bc += 1
		if bc == N:
			flag = False
		ans += 1
	else:
		flag = False
if H > 0:
	ans += (H + amax - 1) // amax
print(ans)


import math
(N, H) = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
	(a[i], b[i]) = map(int, input().split())
p = 0
cnt = 0
nokori = 0
b.sort(reverse=True)
maxi = max(a)
for th in b:
	if p >= H:
		break
	elif th > maxi:
		p += th
		cnt += 1
else:
	nokori = math.ceil((H - p) / maxi)
print(cnt + nokori)


(N, H) = map(int, input().split())
(a, b) = ([0] * N, [0] * N)
for i in range(N):
	(a[i], b[i]) = map(int, input().split())
ma = max(a)
b.sort(reverse=True)
ans = 0
index = 0
while H > 0 and len(b) > index and (b[index] > ma):
	H -= b[index]
	index += 1
	ans += 1
if H > 0:
	ans += (H + ma - 1) // ma
print(ans)


(n, h) = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = max(a, key=lambda x: x[0])[0]
c = sorted((t for (s, t) in a if t > b))
d = 0
while h > 0 and c:
	h -= c.pop()
	d += 1
print(d + max(h - 1, -1) // b + 1)


import math
(N, H) = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
	(A[i], B[i]) = map(int, input().split())
aa = sorted(A, key=lambda x: -x)
bb = sorted(B, key=lambda x: -x)
ans = 0
I = H
mh = max(aa)
for x in bb:
	if x < mh:
		break
	I = I - x
	ans += 1
	if I <= 0:
		break
if I > 0:
	ans += math.ceil(I / max(aa))
print(ans)


(n, h) = map(int, input().split())
xs = [[int(x) for x in input().split()] for _ in range(n)]
a = max((x[0] for x in xs))
ys = sorted((x[1] for x in xs), reverse=True)
for (i, v) in enumerate(ys):
	if v <= a or h <= 0:
		break
	h -= v
else:
	i += 1
j = (max(h, 0) + a - 1) // a
print(i + j)


(N, H) = map(int, input().split())
A = []
B = []
for _ in range(N):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
B.sort(reverse=True)
A.sort(reverse=True)
B = [x for x in B if x > A[0]]
cnt = 0
for i in range(len(B)):
	H -= B[i]
	cnt += 1
	if H <= 0:
		print(cnt)
		exit()
A.sort(reverse=True)
print(cnt - -H // A[0])