#include <bits/stdc++.h>
using namespace std;
struct SuffixArray {
  vector<int> sa, rank, lcp;
  int len;
  void build(const string &s) {
    len = static_cast<int>(s.size());
    if (len > 1) {
      buildSA(s);
      buildLCP(s);
    } else {
      sa.push_back(0);
      rank.push_back(0);
    }
  }
  void buildSA(const string &s) {
    sa.resize(len);
    rank.resize(len);
    vector<int> tmp(len);
    for (int i = 0; i < len; ++i) {
      sa[i] = i;
      rank[i] = s[i];
    }
    int gap = 1;
    auto suffixCmp = [&](int a, int b) {
      if (rank[a] != rank[b]) return rank[a] < rank[b];
      a += gap;
      b += gap;
      return a < len && b < len ? rank[a] < rank[b] : a > b;
    };
    while (tmp.back() < len - 1) {
      sort(sa.begin(), sa.end(), suffixCmp);
      for (int i = 1; i < len; ++i)
        tmp[i] = tmp[i - 1] + suffixCmp(sa[i - 1], sa[i]);
      for (int i = 0; i < len; ++i) rank[sa[i]] = tmp[i];
      gap *= 2;
    }
  }
  void buildLCP(const string &s) {
    lcp.resize(len - 1);
    for (int i = 0, k = 0; i < len; ++i) {
      if (rank[i] != len - 1) {
        for (int j = sa[rank[i] + 1]; s[i + k] == s[j + k]; ++k)
          ;
        lcp[rank[i]] = k;
        k = max(k - 1, 0);
      }
    }
  }
} sa;
string S;
long long targetPos;
int n;
void outerInit() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  auto fi = new ifstream("test.inp");
  if (*fi) {
    cin.rdbuf(fi->rdbuf());
  }
}
void readData() {
  cin >> S >> targetPos;
  n = S.size();
}
void initData() { sa.build(S); }
void solveData() {
  targetPos = (long long)n * (n + 1) / 2 - targetPos + 1;
  if (targetPos <= 0) {
    cout << "No such line.";
    return;
  }
  vector<pair<int, int>> stack;
  for (int i = n - 1; i >= 0; --i) {
    int nDup = (i == 0 ? 0 : sa.lcp[i - 1]);
    int j = n;
    int cnt = 1;
    while (!stack.empty() && stack.back().first >= nDup) {
      int lastLCP = stack.back().first;
      int weight = stack.back().second;
      stack.pop_back();
      long long val = (long long)cnt * (j - sa.sa[i] - lastLCP);
      if (targetPos <= val) {
        long long extraLen = (val - targetPos) / cnt + 1;
        cout << S.substr(sa.sa[i], lastLCP + extraLen);
        return;
      }
      targetPos -= val;
      cnt += weight;
      j = sa.sa[i] + lastLCP;
    }
    long long val = (long long)cnt * (j - sa.sa[i] - nDup);
    if (targetPos <= val) {
      long long extraLen = (val - targetPos) / cnt + 1;
      cout << S.substr(sa.sa[i], nDup + extraLen);
      return;
    }
    targetPos -= val;
    stack.emplace_back(nDup, cnt);
  }
  assert(false);
}
int main() {
  outerInit();
  readData();
  initData();
  solveData();
}
