import Control.Monad
import Data.List

main = do
 [n,k] <- map read . words <$> getLine
 ab <- map (map read . words) <$> replicateM n getLine
 print (bigArray k ab)

bigArray k ab = bigArray' k [] ab
 where
  bigArray' k' acc [] = (sort acc) !! (k-1)
  bigArray' k' acc ([a,b]:ab)
   | k' <= b = (sort ((replicate k' a) ++ acc)) !! (k-1)
   | otherwise = bigArray' (k-b) (replicate b a ++ acc) ab