import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import qualified Data.IntMap as IM

type Map = IM.IntMap Int

readIntsLines :: IO [[Int]]
readIntsLines = map (map (fst . fromJust . BC.readInt) . BC.words) . BC.lines <$> BC.getContents

countUp :: Int -> Int -> Map -> Map
countUp = IM.insertWithKey f
  where f _ new old = old + new

build :: [[Int]] -> Map -> Map
build [] m = m
build ([a, b]:abs) m = build abs $ countUp a b m

solve :: [(Int, Int)] -> Int -> Int -> Int
solve [] _ _ = -1
solve ((n, c):ncs) total target = if next >= target
                              then n
                              else solve ncs next target
  where next = total + c

main :: IO ()
main = do
  [n, k] <- map read . words <$> getLine
  abs <- readIntsLines
  let built = IM.toList $ build abs IM.empty
  print $ solve built 0 k