import Control.Monad
import Text.Printf
import Control.Applicative
import Data.List as L

getInts :: IO [Int]
getInts = map read . words <$> getLine

baseString = "abcdefghijklmnopqrstuvwxyz"

main :: IO()
main = do
  s <- getLine
  [k] <- getInts
  printf "%s" $ slv s k

slv :: String -> Int -> String
slv s 1 = [minimum s]
slv s k | null l = take k $ head slvStr
        | last l == p = slvStr !! (length l - 1)
        | otherwise = take (p - last l) $ slvStr !! length l
  where slvStr = sort $ concat [makeSubString y s [] | y <- baseString]
        lenSlvStr = map length slvStr
        sumLenSlvStr = scanl1 (+) lenSlvStr
        (l, r) = span (<=k) sumLenSlvStr
        p | head l == 1 = k + 1
          | otherwise = k


makeSubString :: Char -> String -> [String] -> [String]
makeSubString _ [] ret = ret
makeSubString c str ret | subStr == "" = ret
                        | otherwise = makeSubString c (tail subStr) (subStr:ret)
  where subStr = dropWhile (/=c) str