#include <bits/stdc++.h>
using namespace std;
struct SuffixAutomaton {
  struct State {
    map<char, int> edges;
    int length = 0, link = 0;
    long long nr_paths = 0, nr_suffix = 0;
    bool is_end = 0;
  };
  vector<State> st;
  void dfs(int nod) {
    if (st[nod].nr_paths) return;
    if (st[nod].is_end) st[nod].nr_suffix = 1;
    for (auto i : st[nod].edges) {
      dfs(i.second);
      st[nod].nr_paths += st[i.second].nr_paths;
      st[nod].nr_suffix += st[i.second].nr_suffix;
    }
    st[nod].nr_paths += st[nod].nr_suffix;
  }
  void calc() { dfs(0); }
  SuffixAutomaton(string s) {
    int last = 0;
    st.emplace_back();
    st[0].link = -1;
    for (auto i : s) {
      int nod = st.size();
      st.emplace_back();
      st.back().length = st[last].length + 1;
      int p = last;
      while (p >= 0 && st[p].edges.find(i) == st[p].edges.end())
        st[p].edges[i] = nod, p = st[p].link;
      if (p != -1) {
        int q = st[p].edges[i];
        if (st[q].length == 1 + st[p].length)
          st[nod].link = q;
        else {
          int q2 = st.size();
          st.push_back(st[q]);
          st.back().length = st[p].length + 1;
          st[q].link = st[nod].link = q2;
          while (p >= 0 && st[p].edges[i] == q)
            st[p].edges[i] = q2, p = st[p].link;
        }
      }
      last = nod;
    }
    while (last) st[last].is_end = 1, last = st[last].link;
    calc();
  }
  string k_th(int k) {
    string ans;
    int act = 0;
    while (k) {
      int frm = act;
      for (auto i : st[act].edges) {
        if (k <= st[i.second].nr_paths) {
          ans += i.first;
          k = max(0LL, k - st[i.second].nr_suffix);
          act = i.second;
          break;
        } else
          k -= st[i.second].nr_paths;
      }
      if (frm == act) {
        ans = "No such line.";
        break;
      }
    }
    return ans;
  }
};
int main() {
  string s;
  cin >> s;
  int k;
  cin >> k;
  SuffixAutomaton suff(s);
  cout << suff.k_th(k) + "\n";
  return 0;
}
