import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import qualified Data.IntMap as I
import qualified Data.Map as M

main = do
    s <- getLine
    k <- readLn
    putStrLn $ solve s k

solve :: String -> Int -> String
solve s k = (sort (allsub s)) !! (k-1)

allsub :: String -> [String]
allsub str = concat $ map (subuniq str) [1..len]
    where len = length str

subuniq :: String -> Int -> [String]
subuniq str w = nub $ subs str w

subs :: String -> Int -> [String]
subs str w | length str < w = []
           | otherwise = (take w str) : subs (tail str) w