#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<string>ans;
string a;
int main()
{
	cin>>a;
	int n;cin>>n;n--;
	for(int c=1;c<=5;c++)
	{
		for(int i=0;i+c<=a.size();i++)ans.push_back(a.substr(i,c));
	}
	sort(ans.begin(),ans.end());
	ans.erase(unique(ans.begin(),ans.end()),ans.end());
	cout<<ans[n]<<endl;
}
