#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000010;
int len;
string s;
int ra[maxN], tra[maxN], sa[maxN], tmpsa[maxN], cnt[maxN];
void countSort(int k) {
  int maxr = max(300, len);
  memset(cnt, 0, sizeof(cnt[0]) * (maxr + 5));
  for (int i = 0; i < len; i++) cnt[sa[i] + k < len ? ra[sa[i] + k] : 0]++;
  for (int i = 0, t, sum = 0; i < maxr; i++) t = cnt[i], cnt[i] = sum, sum += t;
  for (int i = 0; i < len; i++)
    tmpsa[cnt[sa[i] + k < len ? ra[sa[i] + k] : 0]++] = sa[i];
  for (int i = 0; i < len; i++) sa[i] = tmpsa[i];
}
void buildsa() {
  for (int i = 0; i < len; i++) ra[i] = s[i], sa[i] = i;
  for (int k = 1; k < len; k <<= 1) {
    countSort(k);
    countSort(0);
    int r = 0;
    tra[sa[0]] = 0;
    for (int i = 1; i < len; i++) {
      int t1 = (sa[i] + k < len ? ra[sa[i] + k] : 0);
      int t2 = (sa[i - 1] + k < len ? ra[sa[i - 1] + k] : 0);
      tra[sa[i]] = (ra[sa[i]] == ra[sa[i - 1]] && t1 == t2) ? r : ++r;
    }
    for (int i = 0; i < len; i++) ra[i] = tra[i];
    if (ra[sa[len - 1]] == len - 1) break;
  }
}
int phi[maxN], LCP[maxN];
void computeLCP() {
  phi[sa[0]] = -1;
  for (int i = 1; i < len; i++) phi[sa[i]] = sa[i - 1];
  int L = 0;
  for (int i = 0; i < len; i++) {
    if (phi[i] == -1) {
      LCP[ra[i]] = 0;
      continue;
    }
    while (L < len && s[i + L] == s[phi[i] + L]) L++;
    int TL = L;
    LCP[ra[i]] = TL;
    L = max(L - 1, 0);
  }
}
void qry(int k) {
  long long cnt = 0, pos, tot = 0;
  for (int i = 0; i < len; i++) {
    long long gain = len - 1 - sa[i];
    gain -= LCP[i];
    for (int ii = 1; ii <= gain; ii++) {
      int cur = LCP[i] + ii;
      int mn = cur;
      tot++;
      for (int j = i + 1; j < len; j++) {
        mn = min(mn, LCP[j]);
        if (mn < cur) break;
        tot++;
      }
      if (tot >= k) {
        cout << s.substr(sa[i], LCP[i] + ii);
        return;
      }
    }
  }
  cout << "No such line." << endl;
}
int main() {
  cin >> s;
  s += '&';
  len = s.size();
  buildsa();
  computeLCP();
  int k;
  cin >> k;
  qry(k);
}
