import Data.List
import Control.Monad

main :: IO ()
main = do
  [n, t_lim] <- map read . words <$> getLine :: IO [Int]
  xs <- replicateM n $ (\[x,y] -> (x,y)) . map read . words <$> getLine :: IO [(Int, Int)]
  let ys = map fst $ filter ((<= t_lim) . snd) xs
  putStrLn $ show $ minimum ys