import Control.Monad
import Data.List
main = do
 [n,k] <- map read . words <$> getLine
 asbs<-replicateM n (map read . words <$> getLine)
 let sasbs = sort asbs
 let bs = map last asabs
 print $ head (sasbs !! (f bs k))
f (x:xs) k
    |x>=k = 0
    |otherwise 1 + (f xs (k-x))

