import Data.List

f::Int->Int->Int
f hp d
   |hp<=0 = 0
   |hp `mod` d==0 = hp `div` d
   |otherwise=(hp `div` d) +1

f2::Int->[(Int,Int)]->Int->[Int]
f2 _ [] _=[]
f2 a ((c,b):xs) hp=(c + f (hp-b) a) : f2 a xs hp 

main = do
          e<-getLine
          es<-getContents
          let (n:h:[])=map read (words e)::[Int]
              xs=lines es
              a=maximum $ map (\x -> let (a1:_:[])=map read (words x)::[Int] in a1) xs
              bs1=scanl (+) 0 $ reverse $ sort $ map (\x -> let (_:b1:[])=map read (words x)::[Int] in b1) xs
              bs2=zip [0..] bs1
          putStrLn $ show $ minimum $ f2 a bs2 h