#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
	string s;
	int pos;
	cin >> s;
	cin >> pos;

	vector<string> t;
	for(int i=0; i<s.size(); i++){
		for(int j=1; j<=5; j++){
			t.push_back(s.substr(i,j));
		}
	}
	sort(t.begin(),t.end());
	unique(t.begin(),t.end());
	cout << t[pos-1] << endl;
}