import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

/// 数列の読み込み
auto readNums(T = int)() {
	return readln().chomp.split.map!(to!T).array;
}

/// 数の読み込み
auto readNum(T = int)() {
	return readNums!T.front;
}

/// 指定行数読み込み
auto readRows(size_t rows) {
	return generate(() => readln().chomp).take(rows).array;
}

/// 範囲の計算
auto range(T)(T a, T b, T c, T d) {
    auto start = max(a, c);
    auto end = max(b, d);
    return (start < end) ? tuple(start, end) : tuple(cast(T) 0, cast(T) 0);
}

auto maxElement(R)(R r) {
    return r.reduce!((a, b) => max(a, b));
}

auto minElement(R)(R r) {
    return r.reduce!((a, b) => min(a, b));
}

void main() {
    const rows = readRows(2);
    const s = rows[0];
    const k = rows[1].to!int;
    string[] subs;
    foreach(i; 0 .. s.length) {
        foreach(j; i .. s.length) {
            const ss = s[i .. j + 1];
            immutable pos = subs.count!("a < b")(ss);
            if(pos < subs.length) {
            	if(subs[pos] != ss) {
	            	subs.insertInPlace(pos, ss);
	            	subs = subs[0 .. min(subs.length, k)];
            	}
            } else if(pos < k) {
            	subs ~= ss;
            }
        }
    }
    writefln("%s", subs[k - 1]);
}
