import Control.Monad
import Data.List as L

bigjump :: [[Int]] -> Int -> Int -> Int
bigjump a@([key, times]:left) goal previous
  | current < goal = bigjump left goal current
  | current >= goal = key
  where current = previous + times

main = do
  [n,k] <- map read . words <$> getLine :: IO [Int]
  input <- replicateM n $ (map read . words) <$> getLine :: IO [[Int]]

  let sorted_input = L.sortBy (\a b -> compare (a !! 0) (b !! 0)) input
  let ans = bigjump sorted_input k 0
  print ans