#include <bits/stdc++.h>   using namespace std;   const int oo = numeric_limits<int>::max();   const int n_oo = numeric_limits<int>::min();   const int ALF = 26;   struct SuffixAutomaton {     int toInt(char c) { return c -  a ; }     char toChar(int j) { return char(j +  a ); }     struct Nodo {       vector<int> hijos;       int r;       int l;       int sl;       Nodo(int L = 0) : hijos(ALF, -1), l(L), sl(0), r(1) {}       int& operator[](int idx) { return hijos[idx]; }     };     vector<int> orden;     vector<long long int> seen;     int n, ult;     vector<Nodo> t;     void extender(char c) {       int act = n++;       t.push_back(Nodo(t[ult].l + 1));       int p = ult;       while (~p && t[p][toInt(c)] == -1) {         t[p][toInt(c)] = act;         p = t[p].sl;       }       if (~p) {         int q = t[p][toInt(c)];         if (t[q].l == t[p].l + 1) {           t[act].sl = q;         } else {           int clon = n++;           t.push_back(t[q]);           t[clon].l = t[p].l + 1;           t[clon].r = 0;           t[q].sl = t[act].sl = clon;           while (~p && t[p][toInt(c)] == q) {             t[p][toInt(c)] = clon;             p = t[p].sl;           }         }       }       ult = act;     }     SuffixAutomaton(string s =   ) : n(1), ult(0), t(1) {       t[0].sl = -1;       for (int i = 0; i < s.size(); i++) extender(s[i]);     }     void rTopoSort() {       int m = t[ult].l;       vector<vector<int> > bks(m + 1);       for (int i = 0; i < n; i++) bks[t[i].l].push_back(i);       for (int i = m; i >= 0; i--)         for (int j = 0; j < bks[i].size(); j++) orden.push_back(bks[i][j]);     }     void cuentaRepeticiones() {       rTopoSort();       for (int i = 0; i < n - 1; i++) {         int u = orden[i];         int v = t[u].sl;         t[v].r += t[u].r;       }       t[0].r = 1;     }     long long int dfs(int u) {       if (seen[u]) return seen[u];       long long int& ret = seen[u];       ret = t[u].r;       for (int i = 0; i < ALF; i++) {         if (t[u][i] == -1) continue;         ret += dfs(t[u][i]);       }       return ret;     }     void cuentaCaminos() {       seen = vector<long long int>(n);       dfs(0);     }     string kth(long long int k) {       int u = 0;       k++;       string ans;       if (k > seen[0]) return  No such line. ;       while (true) {         k -= t[u].r;         if (k <= 0) return ans;         for (int i = 0; i < ALF; i++) {           if (t[u][i] == -1) continue;           if (k > seen[t[u][i]])             k -= seen[t[u][i]];           else {             ans.push_back(toChar(i)), u = t[u][i];             break;           }         }       }       return ans;     }     void imprime() {       for (int i = 0; i < n; i++) {         cout << i <<   n ;         cout <<  suffix link:   << t[i].sl <<   n ;         cout <<  length:   << t[i].l <<   n ;         cout <<  reps:  << t[i].r <<   n ;         for (int j = 0; j < ALF; j++) {           if (t[i][j] == -1) continue;           cout << toChar(j) <<  :   << t[i][j] <<    ;         }         cout <<   n ;         cout <<   n ;       }     }   };   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     string s;     cin >> s;     SuffixAutomaton SA(s);     SA.cuentaRepeticiones();     SA.cuentaCaminos();     int k;     cin >> k;     cout << SA.kth(k) <<   n ;     return 0;   }