structure T  = TextIO
structure SC = StringCvt

datatype action = Swing | Throw

fun i2s i = String.map (fn #"~" => #"-" | c => c) (Int.toString i)

fun println s = print (s ^ "\n")

fun nextInt () = T.scanStream (Int.scan SC.DEC) T.stdIn

fun insert (x, act) [] = [(x, act)]
  | insert (x, act) ((y, act')::ls) =
    if x > y orelse x = y andalso act = Swing
    then (x, act)::(y, act')::ls
    else (y, act')::insert (x, act) ls

fun loop (m, ls) =
  if m <= 0 then ls
  else
    let
      val SOME a = nextInt ()
      val SOME b = nextInt ()
    in
      loop (m - 1, insert (b, Throw) (insert (a, Swing) ls))
    end

fun solve (hp, (dmg, Swing)::_)  = (hp + dmg - 1) div dmg
  | solve (hp, (dmg, Throw)::ls) = 1 + solve (hp - dmg, ls)
  | solve _                      = 0

val () =
  let
    val SOME n = nextInt ()
    val SOME h = nextInt ()
  in
    println (i2s (solve (h, loop (n, []))))
  end
