import Control.Monad
import Control.Monad.ST
import qualified Data.ByteString.Char8 as C
import Data.List
import Data.Maybe
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM

main = sol <$> get >>= print

get = fmap (unfoldr (C.readInt . C.dropWhile (==' '))) . C.lines <$> C.getContents  
 
sol ([_,k]:ab) = fromJust . U.findIndex (k<=) . U.scanl1' (+) $ runST $ do
  v <- UM.replicate (1+10^5 :: Int) (0 :: Int)
  forM_ ab $ \[a,b] -> UM.modify v (+b) a
  U.freeze v