import Control.Applicative
import Data.List

main = do
  (n:k:_) <- (map (read::String->Int)) . words <$> getLine
  dat <-
    (sortBy (\a b -> compare (fst a) (fst b))) .
    (map ((\(a:b:_) -> (a,b)) . (map (read::String->Int)) . words)) . lines <$> getContents

  print $ f dat 0 k

  where
    f ((a,b):xs) s k = if k <= s+b then a else f xs (s+b) k
