import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as C
import qualified Data.IntMap.Strict as M
import Data.List

main = sol <$> get >>= print

get = fmap (unfoldr (C.readInt . C.dropWhile (==' '))) . C.lines <$> C.getContents 

sol ([n,k]:ab) = (a!) $ bsearch 0 m ((k<=) . (b!))
  where
  mp = M.fromListWith (+) $ (\[a,b] -> (a,b)) <$> ab
  m = M.size mp
  (a,b) = (,) <$> listArray (1,m) . fmap fst <*> listArray (1,m) . scanl1 (+) . fmap snd
    $ M.toAscList mp :: (UArray Int Int, UArray Int Int)

bsearch :: Int -> Int -> (Int -> Bool) -> Int
bsearch l r p -- precondition: not (p l) && (p r)
  | l+1>=r    = r
  | p m       = bsearch l m p
  | otherwise = bsearch m r p
  where m = (l+r) `div` 2