module Main where
import qualified Data.Map as M
import Data.Function
main = do
  n:k:_ <- map read . words <$> getLine :: IO [Int]
  xs <- flip fix (M.empty, n) $ \loop (ints, cnt) -> do
    if cnt == 0 then return ints
    else do
    a:b:_ <- map read . words <$> getLine :: IO [Int]
    let n = b + M.findWithDefault 0 a ints
    let ints' = M.insert a n $ ints
    loop (ints', cnt-1)

  flip fix (xs, 0) $ \loop (ints, num) -> do
    if M.null ints then return ()
    else do
    let ((i,n),ints') = M.deleteFindMin ints
        newNum = num + n
    if newNum >= k
    then print i
    else loop (ints', newNum)
  return ()
