#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

int main() {
	int i, j, k1, k2, k3;
	int k;
	string str, ss[5][5];

	cin >> str;
	cin >> k;

	ss[0][0] = str[0];
	map<string, int>mp1;
	map<string, int>mp2;
	map<string, int>mp3;
	map<string, int>mp4;
	map<string, int>mp5;

	for (i = 0; i < str.length(); i++) {
		mp1.insert(pair<string, int>(str.substr(i,1), i));
	}
	
	int cnt = 0;
	map<string, int>::iterator it;
	map<string, int>::iterator it2;
	map<string, int>::iterator it3;
	map<string, int>::iterator it4;
	map<string, int>::iterator it5;

	int cnt3 = 0;
	for (it = mp1.begin(); it != mp1.end(); it++) {
		mp2.insert ( pair<string, int >( (*it).first, 0));

		for (i = str.find((*it).first, 0); i >= 0; i = str.find((*it).first, i+1)) {
			//if ((*it).first == str.substr(i,1)) {
				
				auto itr = mp2.find(str.substr(i, 2));
				if (itr != mp2.end()) continue;
				mp2.insert(pair<string, int>(str.substr(i, 2), i));
				
				//for (j = 0; j < str.length(); j++) {
				for (j = str.find(str.substr(i,2), 0); j >=0;  j = str.find(str.substr(i, 2),j+1)) {
					//if (str.substr(i, 2) == str.substr(j, 2)) {
						auto itr2 = mp2.find(str.substr(j, 3));
						if (itr2 != mp2.end()) continue;
						mp2.insert(pair<string, int>(str.substr(j, 3), j));
					//}

					//for (k1 = 0; k1 < str.length(); k1++) {0
					for(k1 = str.find( str.substr(j,3),0); k1>=0; k1=str.find(str.substr(j,3), k1+1)){
						//if (str.substr(j, 3) == str.substr(k1, 3)) {
							auto itr3 = mp2.find(str.substr(k1, 4));
							if (itr3 != mp2.end()) continue;

							mp2.insert(pair<string, int>(str.substr(k1, 4), k1));
						//}

						//for (k2 = 0; k2 < str.length(); k2++) {
							for (k2 = str.find(str.substr(k1, 4), 0); k2>=0; k2 = str.find(str.substr(k1,4), k2+1)){
							//if (str.substr(k1, 4) == str.substr(k2, 4)) {
								auto itr4 = mp2.find(str.substr(k2, 5));
								if (itr4 != mp2.end()) continue;
								mp2.insert(pair<string, int>(str.substr(k2, 5), k2));
							//}
						}
					}
				}
			//}
		}

		cnt3++;
		if (cnt3 >= 5)break;
	}
/*
	for (it = mp1.begin(); it != mp1.end(); it++) {

		cnt++;
		if (cnt == k) {
			cout << (*it).first << endl;

			getchar();
			getchar();
			return 0;
		}

		for (i = 0; i < str.length(); i++) {
			if (str[i] == (*it).first) {
				mp2.insert(pair<string, int>(str.substr(i, 2), i));
			}
		}
		cnt++;
		if (cnt == k) {
			map<string, int>::iterator itt=mp2.begin();
			cout << (*itt).first << endl;

			getchar();
			getchar();
			return 0;
		}

		for (it2 = mp2.begin(); it2 != mp2.end(); it2++) {
			mp3.insert(pair<string, int>(str.substr((*it2).second, 3), i));
		}
	



		break;


	}
	*/
	
	//for (it = mp1.begin(); it != mp1.end(); it++) {
		//cout << (*it).first << endl;
	//}

	int cnt2 = 0;
	for (it2 = mp2.begin(); it2 != mp2.end(); it2++) {
		cnt2++;
		if (cnt2 == k) {
			cout << (*it2).first << endl;
			break;
		}
		//cout << (*it2).first << endl;
	}

	//for (it3 = mp3.begin(); it3 != mp3.end(); it3++) {
		//cout << (*it3).first << endl;
	//}







	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 640