
fun main(args:Array<String>):Unit{
    val string = readLine()!!.trim()
    val k = readLine()!!.toInt()
    val res = search(string, k, (-1 until string.length - 1).toList(), "")
    println(when(res){
        is Right-> res.value
        else -> ""
    })
}
open class Either<out L, out R>
class Left<out L>(val value:L):Either<L, Nothing>()
class Right<out R>(val value:R):Either<Nothing, R>()
fun search(string:String, k:Int, index:List<Int>, substring:String):Either<Int, String>{
    if (index.isEmpty()) return Left(k + 1)
    if (k == 0) return Right(substring)
    else {
        var next = k
        for (c in "abcdefghijklmnopqrstuvwxyz") {
            val r = search(string, next - 1, indexSuccWithChar(string, index, c), substring + c)
            when(r){
                is Right -> return r
                is Left -> next = r.value
            }
        }
        return Left(next)
    }
}
fun indexSuccWithChar(string:String, index:List<Int>, char:Char):List<Int>{
    return index.map{it + 1}.filter{it < string.length && string[it] == char}
}
