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

getInts :: IO [Int]
getInts = map read . words <$> getLine

main :: IO()
main = do
  s <- getLine
  [k] <- getInts
  printf "%s" $ slv s k

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..10]]


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)