let S = readLine()!.characters.map{"\($0)"}
let N = S.count
let K = Int(readLine()!)!
var sub = Set<String>()
for i in 0..<N {
    var s = ""
    for j in i..<min(i+K, N) {
        s += S[j]
        sub.insert(s)
    }
}
print(Array(sub).sort()[K-1])