import Control.Monad

merge :: [(Int, Int)] -> [(Int, Int)] -> [(Int, Int)]
merge xs [] = xs
merge [] ys = ys
merge (x:xs) (y:ys)
    | fst x < fst y = x : merge xs (y:ys)
    | otherwise     = y : merge (x:xs) ys

msort :: [(Int, Int)] -> [(Int, Int)]
msort [] = []
msort [x] = [x]
msort x = merge (msort (take h x)) (msort (drop h x))
    where
        h = length x `div` 2

minus :: Int -> Int -> Int
n `minus` m = if n - m <= 0 then 0 else n - m

getN :: Int -> [(Int, Int)] -> Int
getN 0 (x:xs) = fst x
getN n (x:xs) = if n `minus` snd x == 0 then fst x else getN (n `minus` snd x) xs


main = do
  [n, k] <- map read . words <$> getLine
  numPares <- replicateM n $ do
                [p, q] <- map read . words <$> getLine
                return (p,q)
                
  putStrLn $ show $ getN k (msort numPares)