import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	string s = chomp(readln());
	int n = to!int(s.length);
	int K;
	scanf("%d", &K);
	string[] S;
	foreach (len; 1..K+1) {
		foreach (i; 0..n-len+1) {
			S ~= s[i..i+len];
		}
	}
	writeln(S.sort.uniq.array[K-1]);
}