import kotlin.math.min

fun main() {
    val s = readLine() ?: return
    val k = readLine()?.toInt() ?: return

    val list = mutableSetOf<String>()
    val find = StringBuilder()
    'a'.until('z' + 1).forEach { c ->
        0.until(s.length).forEach { i ->
            val si = s[i]
            if (si == c) {
                find.clear()
                find.append(si.toString())
                list.add(find.toString())
                (i + 1).until(min(i + k, s.length)).forEach { j ->
                    find.append(s[j])
                    list.add(find.toString())
                }
            }
        }
        if (list.size >= k + 1) {
            println(list.sorted()[k - 1])
            return
        }
    }
    println(list.sorted()[k - 1])
}
