import Control.Applicative
import qualified Data.IntMap as IMap

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 = fd k dic
    where dic = make list

fd k dic = if b >= k then a else (fd (k-b) dic_)
    where ((a,b),dic_) = IMap.deleteFindMin dic

make :: [(Int,Int)] -> IMap.IntMap Int
make list = foldl append start list
    where start = IMap.fromList (zip [1..100000] (repeat 0))

append :: IMap.IntMap Int -> (Int,Int) -> IMap.IntMap Int
append dic (a,b) = IMap.update (\y -> Just (y+b)) a dic
