import Control.Monad
import Data.List
main = map read . words <$> getLine >>= \[n, k] -> replicateM n (map read . words <$> getLine) >>= print . fst . head . dropWhile ((<k) . snd) . scanl (\(_, x) (t, y) -> (t, x+y)) (0, 0) . sort . map (\[a, b] -> (a, b))