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