import Control.Applicative
import Data.Set as Set
import Data.List as List

chunksOf :: Int -> [a] -> [[a]]
chunksOf n [] = []
chunksOf n xs = (take n xs):(chunksOf n $ drop n xs)

f :: Int -> String -> [String]
f n s
  | n <= (length s) = (take n s):(f n $ tail s)
  | otherwise = []

g :: Int -> String -> (Set String)
g n s
  | n <= (length s) = Set.insert (take n s) (g n $ tail s)
  | otherwise = fromList []

main = do
  s <- getLine
  k <- read <$> getLine :: IO Int
  --let s = "atcoderandatcodeer"
  --let k = 5
  --let s = "aba"
  --let k = 4
  --print $ Set.toAscList $ Set.unions $ List.map (\i -> g i s) [1..k]
  putStrLn $ (!! (k - 1)) $ List.sort $ List.nub $ List.concat $ List.map (\i -> f i s) [1..k]
