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

void main()
{
	auto s = readln.strip;
	auto k = readln.strip.to!int - 1;
	auto substrings = [ s ];
	
	for( int index = 0; index < s.length; index++ )
	{
		for( int length = 1; length < s.length; length++ )
		{
			if( s.length < index + length ) break;
			substrings ~= s[ index .. index + length ];
		}
	}
	
	writeln( sort( substrings ).uniq.array[ k ] );
}
