import Control.Monad
import Text.Printf
import Control.Applicative
import Data.List

main :: IO()
main = do
  s <- getLine
  k <- getLine
  printf "%s" $ slv s (read k :: Int)

slv :: String -> Int -> String
slv s k = subStrs !! (k - 1)
  where subStrs = map head $ group $ sort $ concat [subStrings y (length s - (y - 1)) s [] | y <- [1..k]]

subStrings :: Int -> Int -> String -> [String] -> [String]
subStrings k cnt str ret | cnt <= 0 = ret
                         | otherwise = subStrings k (cnt-1) (tail str) (take k str:ret)