Problem:
Score : 400 points

Problem Statement

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

1 10
3 5

Sample Output 1

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.

Sample Input 2

2 10
3 5
2 6

Sample Output 2

2

In addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.

Sample Input 3

4 1000000000
1 1
1 10000000
1 30000000
1 99999999

Sample Output 3

860000004

Sample Input 4

5 500
35 44
28 83
46 62
31 79
40 43

Sample Output 4

9

Solution in Common Lisp (SBCL 1.1.14) (judge verdict: Accepted)

;; -*- coding:utf-8 -*-

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter O3 '(optimize (speed 3) (safety 0) (debug 0)))
  (defparameter O2 '(optimize (speed 3) (safety 1))))

(defmacro print-line (obj &optional (stream '*standard-output*))
  `(prog1 (princ ,obj ,stream) (terpri ,stream)))


;; Hauptteil

(defmacro split-and-bind (arg-lst string &body body)
  (let ((pos1 (gensym "POS"))
	(pos2 (gensym "POS"))
	(str-evaled (gensym "STR")))
    (labels ((expand (arg-lst &optional (init-pos1 t))
	       (if (null arg-lst)
		   body
		   `((let* ((,pos1 ,(if init-pos1 0 `(1+ ,pos2)))
			    (,pos2 (position #\space ,str-evaled :start ,pos1 :test #'char=))
			    (,(car arg-lst) (parse-integer ,str-evaled :start ,pos1 :end ,pos2)))
		       ,@(expand (cdr arg-lst) nil))))))
      `(let ((,str-evaled ,string))
	 ,@(expand arg-lst)))))

(deftype unum () '(integer 0 1000000000))

(defun qsort (arr)
  (declare #.O3
	   ((simple-array unum) arr))
  (labels ((quicksort (arr lo hi)
	     (declare (unum hi lo)
		      ((simple-array unum) arr))
	     (if (> hi lo)
		 (let* ((mid (round (+ lo hi) 2))
			(i lo)
			(j (+ hi 1))
			(p (aref arr mid)))
		   (declare (unum i j))
		   (rotatef (aref arr mid) (aref arr lo))
		   (loop
		      (loop do (incf i)
			 until (or (> i hi)
				   (> p (aref arr i)))) ; beliebige Präd.
		      (loop do (decf j)
			 until (or (<= j lo)
				   (> (aref arr j) p))) ; beliebige Präd.
		      (if (< j i) (return))
		      (rotatef (aref arr i)(aref arr j)))
		   (rotatef (aref arr lo) (aref arr j))
		   (quicksort arr lo (- j 1))
		   (quicksort arr i hi)))
	     arr))
    (quicksort arr 0 (- (length arr) 1))))

(defun main ()
  (declare #.O3)
  (let* ((n (the unum (read)))
	 (init-hp (read))
	 (max-a 0)
	 (arr-b (make-array n :element-type 'unum)))
    (dotimes (idx n)
      (split-and-bind (a b) (the string (read-line))
	(declare (unum a b))
	(when (>= a max-a) (setf max-a a))
	(setf (aref arr-b idx) b)))
    (let* ((arr-b (qsort arr-b)))
      (declare ((simple-array unum) arr-b))
      (print-line
       (loop with hp of-type fixnum = init-hp
	  for idx of-type unum from 0 below n
	  until (> max-a (aref arr-b idx))
	  do (decf hp (aref arr-b idx))
	    (when (<= hp 0)
	      (return (+ idx 1)))
	  finally (return (+ idx
			     (ceiling (max hp 0) max-a))))))))

#-swank(main)


;; Für Test
(defun get-clipbrd ()
  (with-output-to-string (out)
    (run-program "C:/msys64/usr/bin/cat.exe" '("/dev/clipboard") :output out)))

(defun test ()
  (with-input-from-string (*standard-input* (delete #\return (get-clipbrd)))
    (main)))


;; Für Benchmark
(defparameter *file-path* *load-pathname*)
(defparameter *dir-path* (pathname (directory-namestring *file-path*)))
(defparameter *dat-path* (merge-pathnames "test.dat" *dir-path*))

#+swank
(with-open-file (out *dat-path*
		     :direction :output :if-exists :supersede)
  )

(defun bench ()
  (let ((*standard-output* (make-broadcast-stream)))
    (with-open-file (*standard-input* *dat-path*)
      (time (main)))))