{-# LANGUAGE ScopedTypeVariables #-}

import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Data.Char
import Control.Monad

solve :: VU.Vector Int -> Int -> Int -> Int -> Int
solve vec n acc i 
    | (acc+v) >= n = i 
    | otherwise = solve vec n (acc+v) (i+1)
    where
        v = vec VU.! i

main = do
    [n, t] <- map read . words <$> getLine :: IO [Int]
    (vec :: VUM.IOVector Int) <- VUM.replicate (10^5+1) 0 
    forM_ [1..n] $ \_ -> do
        bs <- B.getLine
        let
            Just (a, bs') = B.readInt bs
            Just (b, _) = B.readInt $ B.dropWhile isSpace bs'
        VUM.modify vec (+b) a
    vec' <- VU.unsafeFreeze vec
    print $ solve vec' t 0 0