import Control.Applicative
import Data.List
import qualified Data.Set as Set

main = do
    [n,k] <- map read . words <$> getLine  :: IO [Int]
    list <- sequence (replicate n ((\[x,y]->(x,y)) . map read . words <$> getLine)) :: IO [(Int,Int)]
    print $ solve k list

solve :: Int -> [(Int,Int)] -> Int
solve k list = (sort ( f list)) !! (k-1)

f :: [(Int,Int)] -> [Int]
f [] = []
f ((a,b):xs) = (replicate b a) ++ f xs
