// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <iostream>

using namespace std;

const int mx = 5500;

string str;

string num[mx*5];

bool cmp(string a,string b)

{

    int len=min(a.length(),b.length());

    for(int i=0;i<len;i++){

        if(a[i]!=b[i])

            a[i]<b[i];

    }

    if(a.length()<b.length())

        return a<b;

    else

        return a>b;

}

int main()

{

    int k;

    while(cin>>str){

        cin>>k;

        int len=str.length();

//        char sign='z';

//        for(int i=0;i<len;i++)

//            if(str[i]<sign)

//                sign=str[i];

        int cont=0;

        for(int i=0;i<len;i++){

            string s="";

            s=s+str[i];

            num[cont++]=s;

            for(int j=1;j<=4;j++){

                if(i+j<len){

                    s=s+str[i+j];

                    num[cont++]=s;

                }

            }

        }

//        cout<<cont<<endl;

        sort(num,num+cont);

//        for(int i=0;i<cont;i++)

//            cout<<num[i]<<endl;

        int tmp=unique(num,num+cont)-num;

//        for(int i=0;i<cont;i++)

//            cout<<"       "<<num[i]<<endl;

        cout<<num[k-1]<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.893649081270862x):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef long double ld;

typedef vector<int> vi;

typedef vector<vector<int> > vvi;

typedef pair<int, int> pii;



#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)

#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)

#define all(v) ((v).begin()), ((v).end())

#define sz(v) ((int)((v).size()))

#define mod(n, m) ((n%m + m) % m)

#define reset(n, m) memset(n, m, sizeof n)

#define endl '\n'



// Begins Suffix Arrays implementation

// O(n log n) - Manber and Myers algorithm

// Refer to "Suffix arrays: A new method for on-line string searches",

// by Udi Manber and Gene Myers



//Usage:

// Fill str with the characters of the string.

// Call SuffixSort(n), where n is the length of the string stored in str.

// That's it!



//Output:

// sa = The suffix array. Contains the n suffixes of str sorted in lexicographical order.

//       Each suffix is represented as a single integer (the saition of str where it starts).

// rank = The inverse of the suffix array. rank[i] = the index of the suffix str[i..n)

//        in the sa array. (In other words, sa[i] = k <==> rank[k] = i)

//        With this array, you can compare two suffixes in O(1): Suffix str[i..n) is smaller

//        than str[j..n) if and only if rank[i] < rank[j]



const int N = 1e5 + 5;

int str[N]; //input

int rnk[N], sa[N]; //output

int cnt[N], nxt[N]; //internal

bool bh[N], b2h[N];



// Compares two suffixes according to their first characters

bool smaller_first_char(int a, int b)

{

	return str[a] < str[b];

}



void suffixArray(int n)

{

	//sort suffixes according to their first characters

	for (int i = 0; i < n; ++i)

	{

		sa[i] = i;

	}

	sort(sa, sa + n, smaller_first_char);

	//{sa contains the list of suffixes sorted by their first character}



	for (int i = 0; i < n; ++i)

	{

		bh[i] = i == 0 || str[sa[i]] != str[sa[i - 1]];

		b2h[i] = false;

	}



	for (int h = 1; h < n; h <<= 1)

	{

		//{bh[i] == false if the first h characters of sa[i-1] == the first h characters of sa[i]}

		int buckets = 0;

		for (int i = 0, j; i < n; i = j)

		{

			j = i + 1;

			while (j < n && !bh[j])

				j++;

			nxt[i] = j;

			buckets++;

		}

		if (buckets == n)

			break; // We are done! Lucky bastards!

		//{suffixes are separted in buckets containing strings starting with the same h characters}



		for (int i = 0; i < n; i = nxt[i])

		{

			cnt[i] = 0;

			for (int j = i; j < nxt[i]; ++j)

			{

				rnk[sa[j]] = i;

			}

		}



		cnt[rnk[n - h]]++;

		b2h[rnk[n - h]] = true;

		for (int i = 0; i < n; i = nxt[i])

		{

			for (int j = i; j < nxt[i]; ++j)

			{

				int s = sa[j] - h;

				if (s >= 0)

				{

					int head = rnk[s];

					rnk[s] = head + cnt[head]++;

					b2h[rnk[s]] = true;

				}

			}

			for (int j = i; j < nxt[i]; ++j)

			{

				int s = sa[j] - h;

				if (s >= 0 && b2h[rnk[s]])

				{

					for (int k = rnk[s] + 1; !bh[k] && b2h[k]; k++)

						b2h[k] = false;

				}

			}

		}

		for (int i = 0; i < n; ++i)

		{

			sa[rnk[i]] = i;

			bh[i] |= b2h[i];

		}

	}

	for (int i = 0; i < n; ++i)

	{

		rnk[sa[i]] = i;

	}

}

// End of suffix array algorithm



// Begin of the O(n) longest common prefix algorithm

// Refer to "Linear-Time Longest-Common-Prefix Computation in Suffix

// Arrays and Its Applications" by Toru Kasai, Gunho Lee, Hiroki

// Arimura, Setsuo Arikawa, and Kunsoo Park.

int lcp[N];

// lcp[i] = length of the longest common prefix of suffix sa[i] and suffix sa[i-1]

// lcp[0] = 0

void getlcp(int n)

{

	for (int i = 0; i < n; ++i)

		rnk[sa[i]] = i;

	lcp[0] = 0;

	for (int i = 0, h = 0; i < n; ++i)

	{

		if (rnk[i] > 0)

		{

			int j = sa[rnk[i] - 1];

			while (i + h < n && j + h < n && str[i + h] == str[j + h])

				h++;

			lcp[rnk[i]] = h;

			if (h > 0)

				h--;

		}

	}

}

// End of longest common prefixes algorithm



int main()

{

	ios_base::sync_with_stdio(0);

	cin.tie(0);



	string x;

	cin >> x;

	rep(i, 0, sz(x))

		str[i] = x[i];

	int k;

	cin >> k;



	suffixArray(sz(x));

	getlcp(sz(x));

	int ans = 0, pos = 0, len = 0;

	rep(i, 0, sz(x))

	{

		int temp = sz(x) - sa[i] - lcp[i];

		if (ans + temp < k)

			ans += temp;

		else

		{

			pos = sa[i];

			len = ans + temp - k;

			len = lcp[i] + temp - len;

			break;

		}

	}



	cout << x.substr(pos, len) << endl;

	return 0;

}