import Control.Monad (replicateM)
import Data.List (sortBy)

conv [a, b] = (a, b)

solve k (t:ts) =
  let v = (k - snd t) in
    if v <= 0
      then fst t
      else solve v ts

main = do
  [n, k] <- fmap read <$> words <$> getLine :: IO [Int]
  ts <- fmap conv <$> fmap (fmap read) <$> fmap words <$> replicateM n getLine :: IO [(Int, Int)]
  putStrLn . show . solve k . sortBy (compare) $ ts
