import java.util.*
fun main(args: Array<String>) {
    val s = readLine()!!
    val K = readLine()!!.toInt()

    val topK = LinkedList<String>()
    (0 until s.length).forEach { i ->
        (i + 1 .. Math.min(s.length, i + 1 + K)).forEach { j ->
            val sub = s.substring(i, j)
            if (!topK.contains(sub)) {
                topK.add(s.substring(i, j))
            }
            topK.sort()
            if (topK.size > K) {
                topK.removeLast()
            }
        }
    }
    println(topK.get(K - 1))
}
