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 k s)) !! (k-1)
 
allsub :: Int -> String -> [String]
allsub k str = concat $ map (subuniq str) [1..k]
 
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