import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int readint() { return readln.chomp.to!int; }

void main() {
    string s = readln.chomp;
    int k = readint();
    int n = s.length.to!int;

    string[] subs;
    foreach (st; 0..n) foreach(len; 1..n+1-st) {
        if (len > 5) break;
        subs ~= s[st..st+len];
    }
    subs.sort().uniq.array[k - 1].writeln;
}