
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;
	
	
	
	string[] heads;
	
	foreach( c; s )
	{
		heads ~= [ c ];
	}
	heads = sort( heads ).uniq.array;
	
	
	
	string[] subs;
	int delta = k;
	
	foreach( head; heads )
	{
		for( auto index = 0; index < s.length; index++ )
		{
			index = s.indexOf( head, index );
			if( index < 0 ) break;
			
			for( int length = 1; length <= s.length; length++ )
			{
				if( s.length < index + length ) break;
				subs ~= s[ index .. index + length ];
			}
		}
		
		subs = sort( subs ).uniq.array;
		if( delta < subs.length ) break;
		
		delta -= subs.length;
		subs = subs.init;
	}
	
	writefln( subs[ delta ] );
}
