#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100010;
const long double inf = 1e8, eps = 1e-9, PI = 4 * atan(1);
int p[20][maxn], t[maxn];
pair<pair<int, int>, int> arr[maxn];
string s;
bool ch(pair<int, int> x, pair<int, int> y) {
  for (register int i = (0); i < (int)(min(x.second, y.second)); ++i)
    if (s[x.first + i] != s[y.first + i])
      return s[x.first + i] < s[y.first + i];
  return x.second <= y.second;
}
struct heap {
  pair<int, int> v[maxn];
  int size;
  heap() {
    fill(v, v + maxn, make_pair(inf, inf));
    size = 1;
  }
  void push(pair<int, int> x) {
    v[size++] = x;
    int w = size - 1;
    while (w > 1 && ch(v[w], v[w / 2])) {
      swap(v[w], v[w / 2]);
      w /= 2;
    }
  }
  pair<int, int> top(void) {
    swap(v[1], v[--size]);
    int w = 1;
    while ((w * 2 < size && (!ch(v[w], v[w * 2])) ||
            (w * 2 + 1 < size && !ch(v[w], v[2 * w + 1])))) {
      if (w * 2 == size - 1 || ch(v[2 * w], v[2 * w + 1])) {
        swap(v[w], v[2 * w]);
        w *= 2;
      } else {
        swap(v[w], v[2 * w + 1]);
        w = 2 * w + 1;
      }
    }
    return v[size];
  }
} st;
int main() {
  memset(p, 63, sizeof p);
  t[1] = 0;
  for (register int i = (2); i < (int)(maxn); ++i) t[i] = t[i / 2] + 1;
  cin >> s;
  int n = s.length(), d;
  cin >> d;
  for (register int i = (0); i < (int)(n); ++i) p[0][i] = int(s[i]);
  int k = 1, pw = 1;
  while (k <= 2 * n) {
    for (register int i = (0); i < (int)(n); ++i) {
      arr[i] = make_pair(
          make_pair(p[pw - 1][i], ((i + k < n) ? p[pw - 1][i + k] : -1)), i);
    }
    sort(arr, arr + n);
    for (register int i = (0); i < (int)(n); ++i) {
      if (i && arr[i].first == arr[i - 1].first)
        p[pw][arr[i].second] = p[pw][arr[i - 1].second];
      else
        p[pw][arr[i].second] = i;
    }
    k *= 2;
    pw++;
  }
  for (register int i = (0); i < (int)(n); ++i) st.push(make_pair(i, 1));
  for (register int i = (0); i < (int)(d - 1); ++i) {
    if (st.size == 1) {
      cout << "No such line." << endl;
      return 0;
    }
    pair<int, int> x = st.top();
    if (x.first + x.second < n) st.push(make_pair(x.first, x.second + 1));
  }
  if (st.size == 1) {
    cout << "No such line." << endl;
    return 0;
  }
  pair<int, int> x = st.top();
  for (register int i = (0); i < (int)(x.second); ++i) cout << s[x.first + i];
  cout << endl;
  return 0;
}
