import Data.List
import Control.Monad

main = do
    [n, k] <- map read . words <$> getLine
    abss <- replicateM n $ map read . words <$> getLine
    print . getIndex k . map sumSnd $ groupByHead abss

groupByHead = groupBy (\x y -> head x == head y) . sort
sumSnd xs =  [head $ head xs, sum $ map (last) xs]
getIndex k (x:xs) = if last x >= k 
                    then head x
                    else getIndex (k - last x) xs
