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



auto getLetterList( string s )
{
	dchar[] results;
	
	foreach( c; s )
	{
		results ~= c;
	}
	
	return sort( results ).uniq;
}
