fun main(args: Array<String>) {
    val s = readInputLine().toCharArray()
    val k = readInputLine().toInt()
    
    val substrings = mutableSetOf<String>()
    
    for (i in 0 until s.size) {
        var tmp = s[i].toString()
        
        substrings.add(tmp)
        for (j in i + 1 until i + k) {
            if (j == s.size) {
                break
            }
            tmp = tmp + s[j].toString()
            substrings.add(tmp)
        }
    }
    
    val list = substrings.toList().toMutableList()
    list.sort()
    
    println(list[k - 1])
}

fun readInputLine(): String {
    return readLine()!!
}
