{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

main = do
  s <- BS.getLine
  let n = BS.length s
  k <- getInt

  let solve i c set | i >= n && Set.size set >= k   = set
                    | i >= n                        = solve 0 (succ c) set
                    | c /= s `BS.index` i           = solve (i+1) c set
                    | otherwise                     = solve (i+1) c (loop i i set)
        where loop i j set
                | j >= n = set
                | otherwise = let ss = BS.take (j - i + 1) $ BS.drop i s
                                  set' = ss `Set.insert` set
                              in loop i (j+1) set'

      xs = toList $ solve 0 'a' Set.empty

      ans = xs !! (k-1)

  BS.putStrLn ans