CodeEff/ECCO huggingface dataset:
# Original solution

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

"""
基本
・max(A)以上の(B)を全部投げちゃう
・max(A)をひたすら振って、残りHP <= B の時点で投げて終わり

ただし、どれを残すべきかは確定しないので全探索
"""

N, H = list(map(int, input().split()))
A = []
B = []
max_a = 0
max_a_b = 0
max_a_i = 0
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

#    if max_a < a:
#        max_a = a
#        max_a_b = b
#        max_a_i = i


def get_count(N, H, max_a, max_a_b, max_a_i):
    count = 0
    for i in range(N):
        # 残すやつは何もしない
        if i == max_a_i:
            continue

        # 投げる
        if B[i] >= max_a:
            H -= B[i]
            count += 1

    # 近いところまでまとめて引く
    x = ((H-max_a_b) // max_a) - 1
    H -= (max_a * x)
    count += x

    while H > 0:
        if H <= max_a_b:
            # 投げて終わり
            count += 1
            break

        H -= max_a
        count += 1

    return count

ans = INF
for i in range(N):
    count = get_count(N, H, A[i], B[i], i)
    if count < ans:
        ans = count

print(ans)


# Optimized solution

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

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)

max_a = max(A)

t = B[:]
t.sort(reverse=True)

count = 0
for i in range(N):
    # 先に投げても後で投げても同じなので、最初に全部投げちゃう
    # ただし強いものから投げないと、投げ終わる前に倒すケースで引っかかる
    if t[i] >= max_a:
        H -= t[i]
        count += 1

    if H <= 0:
        print(count)
        exit()


# 近いところまでまとめて引く
x = (H // max_a) - 1
H -= (max_a * x)
count += x

while H > 0:
    H -= max_a
    count += 1


print(count)
# Original solution
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)
ans = 0
tmp = 0
cnt = 0
while(1):
    if tmp>=H:
        print(ans)
        exit()
    if cnt==len(B):
        break
    if A[0]>=B[cnt]:
        break
    tmp += B[cnt]
    ans += 1
    cnt += 1

res = H - tmp
if res%A[0]==0:
    ans += res//A[0]
else:
    ans += res//A[0]
    ans += 1
print(ans)

# Optimized solution
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)

ans = 0
cnt = 0
while(1):
    if H<=0:
        print(ans)
        exit()
    if cnt==len(B):
        break
    if A[0]>=B[cnt]:
        break
    H-=B[cnt]
    cnt+=1
    ans+=1

if H%A[0]==0:
    res = H//A[0]
else:
    res = H//A[0]
    res += 1

print((ans+res))
# Original solution
import math

N, H = list(map(int, input().split()))
katana = {i: list(map(int, input().split())) for i in range(N)}

# 振り攻撃最大
max_i, (max_a, max_b) = max(list(katana.items()), key=lambda x: x[1][0])

ans = 0
for i, (_, b) in sorted(list(katana.items()), key=lambda x: x[1][1], reverse=True):
    if i == max_i:
        continue
    if H <= max_b or H <= max_a:
        break
    if b < max_a:
        break
    H -= b
    ans += 1

if max_a < max_b and H > 0:
    H -= max_b
    ans += 1
if H > 0:
    ans += math.ceil(H / max_a)

print(ans)


# Optimized solution
import sys
input = sys.stdin.readline

N, H = list(map(int, input().split()))
a, b = [0] * N, [0] * N
for i in range(N):
    a[i], b[i] = list(map(int, input().split()))

max_a = max(a)
b = [x for x in sorted(b, reverse=True) if x > max_a]

cnt = 0
for bi in b:
    H -= bi
    cnt += 1
    if H <= 0:
        break

if H > 0:
    cnt += H // max_a
    if H % max_a != 0:
        cnt += 1

print(cnt)
# Original solution
# ai<=biなので基本的にbiが強い。最強のaiより弱いbiは使う必要がない
# 順番は関係ないので選びぬかれたbiを強いほうか使っていって、倒せなかったら最強のaiをHがなくなるまで使う
# これだとPypyでギリギリ間に合わん...

n, h = list(map(int, input().split()))
a, b = 0, []
for _ in range(n):
    ai, bi = list(map(int, input().split()))
    a = max(a, ai)
    b.append(bi)
b = list(sorted(b))

l, r = 0, n
while r-l > 0:
    mid = (l + r) // 2
    if b[mid] >= a:
        r = mid
    else:
        l = mid + 1
b = b[r:][::-1]
count = 0
for bi in b:
    h -= bi
    count += 1
    if h <= 0:
        break

if h > 0:
    count += h // a if h % a == 0 else h // a + 1

print(count)


# Optimized solution
# Bを一回使えると考えると
# - Ai>BiであるBiを使う意味はない(Aiで殴ればいいので)
# - Ai>AjであるAjを使う意味はない（Aiで殴ればいいので）
# つまりA中最強のAiより上（i=j自身を含む）のBjを1度使い、あとはAiで殴る
n, h = list(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([x for x in power if x[1] >=  maxa]), key = lambda x : x[1], reverse=True)
ans = 0
for m in muscleb:
    ans += 1
    h -= m[1]
    if h <= 0:
        print(ans)
        exit()
additionala = h // maxa
if h % maxa != 0:
    additionala += 1
print((additionala + ans))
# Original solution
from math import ceil
from bisect import bisect_left


def solve(n, h):
    a = []
    b = []

    for i in range(n):
        ai, bi = list(map(int, input().split()))
        a.append(ai)
        b.append(bi)
        a.sort()
        b.sort()

    if n == 1:
        ans = ceil((h-b[n-1])/a[n-1])+1

    else:
        over_amax = b[bisect_left(b, a[n-1]):]
        if h <= sum(over_amax):
            ans = len(over_amax)
        else:
            ans = ceil((h - sum(over_amax)) / a[n-1]) + len(over_amax)

    return ans


if __name__ == '__main__':
    n, h = list(map(int, input().split()))
    print((solve(n, h)))


# Optimized solution
from math import ceil
from bisect import bisect_left


def solve(n, h):
    a = []
    b = []

    for i in range(n):
        ai, bi = list(map(int, input().split()))
        a.append(ai)
        b.append(bi)

    amax = max(a)
    b.sort()

    if n == 1:
        ans = ceil((h-b[n-1])/amax)+1

    else:
        over_amax = b[bisect_left(b, amax):]
        if h <= sum(over_amax):
            for j in range(n-1, -1, -1):
                h -= b[j]
                if h <= 0:
                    ans = n-j
                    break

        else:
            ans = ceil((h - sum(over_amax)) / amax) + len(over_amax)

    return ans


if __name__ == '__main__':
    n, h = list(map(int, input().split()))
    print((solve(n, h)))
# Original solution
n,h=list(map(int,input().split()))
a=[]
b=[]
for _ in range(n):
    a_i,b_i=list(map(int,input().split()))
    a.append(a_i)
    b.append(b_i)

import bisect,math


b=sorted(b)
index = bisect.bisect_left(b,max(a))

cnt=0
for i in range(n-1,-1,-1):
    if i>=index:
        h-=b[i]
        cnt+=1
    else:
        break
    
    if h<=0:
        h=0
        break

ans=math.ceil(h/max(a))+cnt

print(ans)


# Optimized solution
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)
        exit(0)

cnt = ceil(h/b_max)

print((ans+cnt))
# Original solution
import math

n,h = list(map(int, input().split()))
al = []
bl = []
for _ in range(n):
    a,b = list(map(int, input().split()))
    al.append((a,'swing'))
    bl.append((b,'throw'))

abl = al + bl
abl.sort(reverse=True)

remain_h = h
ans = 0
for v in abl:
    damage, command = v
    if command == 'swing':
        ans += math.ceil(remain_h/damage)
        break
    else:
        ans += 1
        remain_h -= damage
        if remain_h <= 0:
            break

print(ans)

# Optimized solution
n,h = list(map(int, input().split()))
al = []
bl = []
for _ in range(n):
    a,b = list(map(int, input().split()))
    al.append(a)
    bl.append(b)

al.sort(reverse=True)
bl.sort(reverse=True)

amax = al[0]
ans = 0
rem = h
for b in bl:
    if b >= amax:
        rem -= b
        ans += 1
    else:
        break
    if rem <= 0:
        print(ans)
        exit()

cnt = (rem-1)//amax + 1
ans += cnt
print(ans)
# Original solution
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n, h = LI()
power = []
for a, b in LIR(n):
    power += [(a, 1)]
    power += [(b, 0)]


power.sort(reverse=True)
for i in range(2 * n):
    p, flag = power[i]
    h -= p
    if h <= 0:
        print((i + 1))
        exit()
    elif flag:
        print((i + h // p + bool(h % p) + 1))
        exit()

# Optimized solution
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n, h = LI()
A = []
B = []
for _ in range(n):
    a, b = LI()
    A += [a]
    B += [b]

max_a = max(A)
power_sort = sorted(B + [max_a], reverse=True)
for i in range(n + 1):
    h -= power_sort[i]
    if h <= 0:
        print((i + 1))
        exit()
    elif power_sort[i] == max_a:
         print((h // max_a + bool(h % max_a) + i + 1))
         exit()
# Original solution
import math
n, h = list(map(int, input().split()))
sl = 0
th = []
for i in range(n):
    a, b = list(map(int, input().split()))
    sl = max(sl, a)
    th.append(b)

th.sort()
th_damage = th.pop()
turn = 0
while (h > 0):
    if th_damage > sl:
        h -= th_damage
        if len(th) != 0:
            th_damage = th.pop()
        else:
            th_damage = 0
    else:
        turn += math.ceil(h / sl)
        break
    turn += 1

print(turn)


# Optimized solution
# 16:15
import sys
input = lambda: sys.stdin.readline().rstrip()
import math
n, h = list(map(int, input().split()))
sl = 0
th = []
for i in range(n):
    a, b = list(map(int, input().split()))
    sl = max(sl, a)
    th.append(b)

th.sort()
th_damage = th.pop()
turn = 0
while (h > 0):
    if th_damage > sl:
        h -= th_damage
        if len(th) != 0:
            th_damage = th.pop()
        else:
            th_damage = 0
    else:
        turn += math.ceil(h / sl)
        break
    turn += 1

print(turn)
# Original solution
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)
b.append(0)
b = sorted(b, reverse=True)

count = 0
while True:
    if max(b) < max(a):
        count += -(-h // max(a))
        break
    else:
        h -= b.pop(0)
        count += 1

print(count)


# Optimized solution
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)
b.append(0)
a2 = sorted(a, reverse=True)
b2 = sorted(b, reverse=True)

count = 0
while True:
    if h <= 0:
        break
    elif b2[0] <= a2[0]:
        count += -(- h // a2[0])
        break
    else:
        h -= b2.pop(0)
        count += 1

print(count)
# Original solution
from math import ceil

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

Ma = max(a)
b = sorted([x for x in b if x > Ma], reverse=True)
lb = len(b)

t = 0
while t < lb:
    H -= b[t]
    t += 1
    if H <= 0:
        break

if H > 0:
    t += ceil(H / Ma)

print(t)


# Optimized solution
def main():
    import sys
    input = sys.stdin.readline

    N, H = list(map(int, input().split()))

    bs = []
    a_mx = -1
    for _ in range(N):
        a, b = list(map(int, input().split()))
        a_mx = max(a_mx, a)
        bs.append(b)

    bs = [b for b in bs if b > a_mx]
    bs.sort(reverse=True)

    ans = 0
    for b in bs:
        H -= b
        ans += 1
        if H <= 0:
            break
    if H > 0:
        ans += (H + a_mx - 1) // a_mx

    print(ans)


if __name__ == '__main__':
    main()
# Original solution
from functools import reduce
from math import ceil

# 入力
N, H = list(map(int, input().split()))
a, b = list(zip(*(list(map(int, input().split())) for _ in range(N))))

# 投げるべき刀を強力なものから投げる。その後、振るべき刀を降り続ける。
m = max(a)
c = sorted([x for x in b if x > m], reverse=True)
ans = (
    reduce(
        lambda acc, e: (acc[0] + 1, acc[1] + e) if acc[1] < H else acc,
        c,
        (0, 0)
    )[0] if sum(c) >= H else
    len(c) + ceil((H - sum(c)) / m)
)

# 出力
print(ans)


# Optimized solution
from functools import reduce
from math import ceil

# 入力
N, H = list(map(int, input().split()))
a, b = list(zip(*(list(map(int, input().split())) for _ in range(N))))

# 投げるべき刀を強力なものから投げる。その後、振るべき刀を降り続ける。
m = max(a)
c = sorted(
    [x for x in b if x > m],
    reverse=True
)
ans, _ = (
    reduce(
        lambda acc, e:
            (acc[0] + 1, acc[1] + e) if acc[1] < H else
            acc,
        c,
        (0, 0)
    ) if sum(c) >= H else
    (len(c) + ceil((H - sum(c)) / m), 0)
)

# 出力
print(ans)
# Original solution
N,H=list(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]
F=[]
for i in C:
  if max(B)<i:
    F.append(i)
cnt=0
for i in F:
  H-=i
  cnt+=1
  if H<=0:
    print(cnt)
    exit()
print((cnt-((-H)//D[0])))
    

# Optimized solution
N,H=list(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)))
# Original solution
# coding: utf-8
from math import ceil
N, H = list(map(int, input().split()))
li = []
atop = 0
for _ in range(N):
    a, b = list(map(int, input().split()))
    atop = max(atop, a)
    li.append([a, b])
li.sort(key=lambda x: x[1], reverse=True)
# print(li)
ans = ceil(H/atop)
cnt = 0
for i in range(N):
    H -= li[i][1]
    cnt += 1
    ans = min(ans, cnt + max(0, ceil(H/atop)))
print(ans)

# Optimized solution
# coding: utf-8
from math import ceil
N, H = list(map(int, input().split()))
li = []
atop = 0
for _ in range(N):
    a, b = list(map(int, input().split()))
    atop = max(atop, a)
    li.append(b)
li.sort(reverse=True)
# print(li)
ans = ceil(H/atop)
cnt = 0
for i in range(N):
    H -= li[i]
    cnt += 1
    ans = min(ans, cnt + max(0, ceil(H/atop)))
print(ans)
# Original solution
from math import ceil

N, H = list(map(int, input().split()))
sword = [[int(x) for x in input().split()] for _ in range(N)]

max_swing = max(sword, key=lambda x:x[0])[0]

attack = 0
# 投げで攻撃
for i in sorted(sword, key=lambda x: x[1], reverse=True):
  if max_swing < i[1]:
    H -= i[1]
    attack += 1
    if H <= 0:
      break
# 残りを振りで攻撃      
if 0 < H:
  attack += ceil(H / max_swing)
print(attack)  


# Optimized solution
# 振るのは最強のやつだけ
# 投げるのは強い順
 
N,H = list(map(int,input().split()))
AB = [[int(x) for x in input().split()] for _ in range(N)]
A,B = list(zip(*AB))
 
a = max(A) # 振る
B = [b for b in B if b > a] # 投げる価値あり
B.sort(reverse = True)

attack_cnt = 0
 
for b in B:
  if H <= 0:
    break
  attack_cnt += 1
  H -= b
  
if H > 0:
  attack_cnt += (H-1)//a + 1
  
print(attack_cnt)
# Original solution
# -*- coding: utf-8 -*-

from bisect import bisect_left

N, H = list(map(int, input().split()))
A, B = [0]*N, [0]*N
for i in range(N):
    A[i], B[i] = list(map(int, input().split()))

a_max = max(A)
B.sort()
# 一番強い振る刀より弱い投げる刀はいらない
B2 = list(reversed(B[bisect_left(B, a_max):]))

cnt = 0
# 投げるだけで倒せるか
if H <= sum(B2):
    # 強い方から順番に投げる
    for i in range(len(B2)):
        cnt += 1
        H -= B2[i]
        if H <= 0:
            print(cnt)
            exit()
else:
    # 全部投げた結果
    H -= sum(B2)
    cnt += len(B2)
    # 倒すまでに振る回数
    cnt += -(-H // a_max)
    print(cnt)


# Optimized solution
# -*- coding: utf-8 -*-

import sys

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(eval(input()))
def MAP(): return list(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')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, H = MAP()
A = [0] * N
B = [0] * N
for i in range(N):
    a, b = MAP()
    A[i] = a
    B[i] = b

A.sort(reverse=1)
B.sort(reverse=1)

mxa = A[0]
cnt = 0
for b in B:
    if H <= 0 or b <= mxa:
        break
    H = max(0, H-b)
    cnt += 1
cnt += ceil(H, mxa)
print(cnt)
# Original solution
N,H=list(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)
c=0
while B and H>0:
    H-=B.pop()
    c+=1
print((c-(-max(0,H)//A)))

# Optimized solution
N,H=list(map(int,input().split()))
L=[list(map(int,input().split()))for _ in[0]*N]
A=max(a[0]for a in L)
B=sorted(b for _,b in L if b>A)
c=0
while B and H>0:
    H-=B.pop()
    c+=1
print((c-(-max(0,H)//A)))
# Original solution
import math

inn = [int(x) for x in input().split()]
aa = []
bb = []
for i in range(inn[0]):
    tmp = [int(x) for x in input().split()]
    aa.append(tmp[0])
    bb.append(tmp[1])

count = 0
tot = 0
ba = list(filter((lambda x: x > max(aa)), bb))
if sum(ba) == inn[1]:
    print((len(ba)))
    exit()
elif sum(ba) > inn[1]:
    for b in sorted(ba, reverse=True):
        tot += b
        count += 1
        if tot >= inn[1]:
            print(count)
            exit()
else:
    tot = sum(ba)
    count = len(ba) + math.ceil((inn[1]-tot)/max(aa))
    print(count)


# Optimized solution
import math

inn = [int(x) for x in input().split()]
aa = []
bb = []
for i in range(inn[0]):
    tmp = [int(x) for x in input().split()]
    aa.append(tmp[0])
    bb.append(tmp[1])

maxaa = max(aa)
ba = [x for x in bb if x > maxaa]
sumba = sum(ba)
lenba = len(ba)
if sumba == inn[1]:
    print(lenba)
    exit()
elif sumba > inn[1]:
    count = lenba
    tot = sumba
    for b in sorted(ba):
        tot -= b
        if tot < inn[1]:
            print(count)
            exit()
        count -= 1
else:
    count = lenba + math.ceil((inn[1]-sumba)/max(aa))
    print(count)
# Original solution
# ABC 085 D
import bisect, math
N, H = list(map(int, input().split()))
a = []
b = []
for k in range(N):
    x, y = list(map(int, input().split()))
    a.append(x)
    b.append(y)

a = sorted(a)
b = sorted(b)

l = N - bisect.bisect_left(b,a[-1])
b = b[::-1]
ans = 0
for k in range(l):
    ans += 1
    H -= b[k]
    if H <= 0:
        print(ans)
        exit(0)

print((ans + math.ceil(H/a[-1])))


# Optimized solution
import math, sys

def input():
    return sys.stdin.readline()[:-1]

def main():
    N, H = list(map(int,input().split()))
    A = [0 for k in range(N)]
    B = [0 for k in range(N)]
    for k in range(N):
        a, b = list(map(int,input().split()))
        A[k] = a
        B[k] = b
    A = sorted(A)[::-1]
    m = A[0]
    B = sorted(B)[::-1]
    c = 0
    for e in B:
        if e > m:
            c += 1
            H -= e
            if H <= 0:
                print(c)
                exit(0)
        else:
            break
    print((c+math.ceil(H/m)))
if __name__ == '__main__':
    main()
# Original solution
from itertools import accumulate
from bisect import bisect_left
from math import ceil

N,H = list(map(int, input().split()))
AB = []
for _ in range(N):
    AB.append(tuple(map(int, input().split())))

# A昇順、B降順にソート
AB.sort(key=lambda x: (x[0], -x[1]))

# 最後の刀を装備する
equip = AB.pop()

# a_max < b なる刀を集める
b_list = []
for a,b in AB:
    if b > equip[0]:
        b_list.append(b)

# bを攻撃力の高い順に並べ替える
b_list.sort(reverse=True)
b_list_cum = list(accumulate(b_list))
b_list_cum = [0] + b_list_cum
 
ans = 0
# hpがb_list_cum[-1]以下なら、刀投げで終わる
if H <= b_list_cum[-1]:
    ans = bisect_left(b_list_cum,H)
    print(ans)

# 違えば、まずはb>=a_maxなる刀を全部投げ、equipでhp<=bになるまで攻撃し、
# 最後の1手で刀を投げる
else:
    ans = len(b_list_cum)-1
    res = H - b_list_cum[-1]
    a_attack = max(0, int(ceil((res-equip[1]) / equip[0])))
    
    # aで攻撃した分と、最後の1手の刀投げの分を足す
    ans += (a_attack + 1)
    print(ans)

# Optimized solution
from itertools import accumulate
from bisect import bisect_left
from math import ceil

N,H = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
    
# 最も強いaを探す
a_max = max(A)

# それ以上のbを探す
b_strong = []
for b in B:
    if b >= a_max:
        b_strong.append(b)
        
# bをソートしてcum作る
b_strong.sort(reverse=True)
b_cum = list(accumulate(b_strong))
b_cum = [0] + b_cum
    
# もしHPがb_cum[-1]なら投げてるうちに倒せる
if H <= b_cum[-1]:
    ans = bisect_left(b_cum, H)
    
else:
    ans = len(b_cum) - 1
    ans += ceil((H - b_cum[-1]) / a_max)
    
print(ans)
# Original solution
from itertools import accumulate
from bisect import bisect_left
from math import ceil

N,H = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
    
# 最も強いaを探す
a_max = max(A)

# それ以上のbを探す
b_strong = []
for b in B:
    if b >= a_max:
        b_strong.append(b)
        
# bをソートしてcum作る
b_strong.sort(reverse=True)
b_cum = list(accumulate(b_strong))
b_cum = [0] + b_cum
    
# もしHPがb_cum[-1]なら投げてるうちに倒せる
if H <= b_cum[-1]:
    ans = bisect_left(b_cum, H)
    
else:
    ans = len(b_cum) - 1
    ans += ceil((H - b_cum[-1]) / a_max)
    
print(ans)

# Optimized solution
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,h = li()
alis = []
blis = []
for _ in range(n):
    a,b = li()
    alis.append(a)
    blis.append(b)
    
amax = max(alis)
blis.sort()
buse = []
while blis:
    cur = blis.pop()
    if cur > amax:
        buse.append(cur)
    
cnt = 0
res = h
for b in buse:
    res -= b
    cnt += 1
    if res <= 0:
        break
    
if res > 0:
    cnt += -(-res//amax)
    
print(cnt)