import Data.List

f :: Int->String->[String]
f 0 _ =[]
f n str=(take n str) : (f (n-1) str)

f2 :: Int-> String ->[String]
f2 _ []=[]
f2 k a1@(x:xs)=(f k a1) ++ f2 k xs

main = do
      x<-getLine
      y<-getLine
      let k=read y::Int
      putStrLn $ head $ (group $ sort $ f2 k x) !! (k-1)