#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////
class SuffixArray {
  public:
    SuffixArray(const string& str) :
            sz(str.size()),
            log_sz(1 + log2(sz+1)),
            rank(log_sz + 1, vector<int>(sz, 0)),
            ord(sz) {
        BuildSuffixArrayFast(str);
    }

    vector<int> GetSuffixArray() { return ord; }

    // (The length of the) Longest common prefix of str[i...] and str[j...].
    int LCP(int i, int j) {
        if (i == j) return sz-i;
        int res = 0;
        for (int step = log_sz; step >= 0 and i < sz and j < sz; step--) {
            if (rank[step][i] == rank[step][j]) {
                res += 1<<step;
                i += 1<<step;
                j += 1<<step;
            }
        }
        return res;
    }
    
  private:
    void BuildSuffixArrayFast(const string& str) {
        for (int i = 0; i < sz; i++) rank[0][i] = str[i];
        vector<int> ord2(sz);
        // The vector cnt is used for a fast implementation of bucket sort that
        // avoids using a vector of vectors.
        int buckets = max(256, sz); // 256 is the number of different chars.
        vector<int> cnt(buckets, 0);
        // step = -1 is used only for computing the initial ord (a trick to
        // decrease the lines of code).
        for (int step = -1; step < log_sz; step++) {
            // At the end of this iteration ord will contain the suffix array
            // when only the first (1<<step) characters are considered.
            const vector<int>& rk = rank[max(0, step)];
            int chunk = (step == -1) ? sz : 1<<step;
            int len = 0;
            for (int i = max(0, sz - chunk); i < sz; i++) ord2[len] = i, len++;
            for (int i = 0; i < sz; i++) {
                if (ord[i] >= chunk) ord2[len] = ord[i]-chunk, len++;
            }
            // Now ord2 contains the numbers 0, ..., sz-1 ordered with respect
            // to the labels: i -> s[i+(1<<step), i+(1<<(step+1)]
            std::fill(cnt.begin(), cnt.end(), 0);
            for (int i = 0; i < sz; i++) cnt[rk[i]]++;
            for (int i = 1; i < buckets; i++) cnt[i] += cnt[i-1];
            for (int i = sz-1; i >= 0; i--) ord[--cnt[rk[ord2[i]]]] = ord2[i];
            // Here ord contains the numbers 0, ..., sz-1 ordered with respect
            // to the labels: i -> s[i, i+(1<<(step+1)]
            if (step == -1) continue;
            // The following loop is used to compute the new ranking.
            rank[step+1][ord[0]] = 0;
            for (int i = 1; i < sz; i++) {
                rank[step+1][ord[i]] = rank[step+1][ord[i-1]];
                int r1 = (ord[i-1] + chunk < sz) ? rk[ord[i-1]+chunk] : -1;
                int r2 = (ord[i] + chunk < sz) ? rk[ord[i]+chunk] : -1;
                rank[step+1][ord[i]] += rk[ord[i-1]] != rk[ord[i]] || r1 != r2;
            }
        }
    }

    const int sz;
    const int log_sz;
    // The vector rank[step] is such that:
    // rank[step][i] < rank[step][j] iff S[i, i+(1<<step)] < S[j, j+(1<<step)]
    // Furthermore for step > 0 it holds 0 <= rank[step][i] < sz.
    // If step = 0, it is assured that 0 <= rank[0][i] < 256.
    vector<vector<int>> rank;
    // The vector ord contains the suffix array.
    // It is also used as "partial" suffix array while building the
    // complete one.
    vector<int> ord;
};




const int MAXN = -1; 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    string S;
    cin >> S;
    int N = S.size();
    SuffixArray suffarr(S);
    typedef pair<int,int> pii;
    vector<pii> ss;
    for (int i = 0; i < N; i++) for (int j = i+1; j <= min(N, i+6); j++) ss.push_back({i, j});
    auto cmp = [&suffarr, &S] (pii A, pii B){
        int lA = A.second-A.first;
        int lB = B.second-B.first;
        int l = suffarr.LCP(A.first, B.first);
        if (l >= min(lA, lB)) return lA < lB;
        return S[A.first+l] < S[B.first+l];
    };
    auto eq = [&suffarr](pii A, pii B) {
        int lA = A.second-A.first;
        int lB = B.second-B.first;
        if (lA != lB) return false;
        int l = suffarr.LCP(A.first, B.first);
        return l >= lA;
    };
    sort(ss.begin(), ss.end(), cmp);
    ss.erase(unique(ss.begin(), ss.end(), eq), ss.end());
    int K;
    cin >> K;
    for (int i = ss[K-1].first; i < ss[K-1].second; i++) cout << S[i];
    cout << "\n";
}



Measured memory_bytes: 896