#include <bits/stdc++.h>

using namespace std;

vector<string> su;
string s;
int K;

int main()
{
	cin >> s >> K;
	for (int i = 0; s[i] != '\0'; i++) {
		for (int j = i; j < i + K && s[j] != '\0'; j++) {
			su.push_back(s.substr(i, j - i + 1));
		}
	}
	sort(su.begin(), su.end());
	su.erase(unique(su.begin(), su.end()), su.end());
	cout << su[K-1] << endl;
	return 0;
}