import Control.Monad

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

bigArray k ([a,b]:ab)
 | k <= b = a
 | otherwise = bigArray (k-b) ab