import Data.List
import Control.Monad
import Data.Maybe

main :: IO ()
main = do
  [n,k] <- rListM :: IO [Int]
  ls <- mapMaybe twl2tup <$> replicateM n rListM :: IO [(Int,Int)]
  print $ (sort . concat $ fmap (\(a,b) -> replicate b a) ls) !! (k - 1)

rListM :: Read a => IO [a]
rListM = fmap read . words <$> getLine

twl2tup :: [a] -> Maybe (a,a)
twl2tup [e1,e2] = Just (e1,e2)
twl2tup _ = Nothing
