import Data.List
import Data.Tuple
main = do
  [_,k] <- map read . words <$> getLine :: IO [Int]
  abs <- map (\[a,b] -> (a,b)) . map (map read . words) . lines <$> getContents :: IO [(Int,Int)]
  let st = sort $ map swap abs
  let s = scanl (\(a,b) (c,d) -> (c, b+d)) (0,0) $ map swap st
  print . fst . head . dropWhile (\(_,b) -> b < k) $ s  
