{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Data.Char
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as UV

main :: IO()
main = do
  [n, k] <- getIntList
  [as, bs] <- transpose . (sortOn head) <$> replicateM n getIntList
  let cs = tail . scanl (+) 0 $ bs
  print . fst . head . dropWhile ((< k) . snd) $ zip as cs


readInt :: BS.ByteString -> Maybe (Int, BS.ByteString)
readInt = BS.readInt . BS.dropWhile isSpace

getIntList :: IO [Int]
getIntList = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

