import Data.List

solve :: String -> Int -> String
solve s k = let (xs, ys) = substrings s k
            in (!! (k-1)) $ sort $ nub $ xs ++ ys
  where
    substrings :: String -> Int -> ([String], [String])
    substrings "" _ = ([], [])
    substrings _  0 = ([], [])
    substrings (c:cs) k' = let (xs , ys ) = substrings cs (k'-1)
                               (xs', ys') = substrings cs k'
                          in ([c] : map (c:) xs, xs ++ xs' ++ ys ++ ys')

main :: IO ()
main = do
  s <- getLine
  k <- read <$> getLine
  putStrLn $ solve s k
