#include <bits/stdc++.h>
using namespace std;
const int N = 501123;
const int inf = 1e9;
int v;
string s;
int n, k, l, r, w[3], a[N], q;
bool we[5001][5001];
struct bicha {
  int go[2], siz;
};
vector<bicha> t;
void select(int l, int r) { we[l][r] = 1; }
int sz;
void dfs(int v) {
  if (!v) return;
  dfs(t[v].go[0]);
  dfs(t[v].go[1]);
  t[v].siz = t[v].siz + t[t[v].go[0]].siz + t[t[v].go[1]].siz;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> s >> k;
  n = s.size();
  for (int i = 1; i <= n; ++i) {
    a[i] = (s[i - 1] - 'a');
  }
  for (int i = 1; i <= n; ++i) {
    l = i;
    r = i;
    w[0] = w[1] = 0;
    q = 0;
    while (l >= 1 && r <= n) {
      if (a[l] != a[r]) ++w[q];
      if (w[q] == 0) {
        select(l, r);
      }
      q ^= 1;
      --l;
      ++r;
    }
    if (i != n) {
      w[0] = w[1] = 0;
      l = i;
      r = i + 1;
      q = 0;
      while (l >= 1 && r <= n) {
        if (a[l] != a[r]) ++w[q];
        if (w[q] == 0) {
          select(l, r);
        }
        q ^= 1;
        --l;
        ++r;
      }
    }
  }
  bicha pf;
  pf.go[0] = pf.go[1] = pf.siz = 0;
  t.push_back(pf);
  t.push_back(pf);
  sz = 1;
  for (int i = 1; i <= n; ++i) {
    v = 1;
    for (int j = i; j <= n; ++j) {
      if (!t[v].go[a[j]]) {
        t.push_back(pf);
        ++sz;
        t[v].go[a[j]] = sz;
      }
      v = t[v].go[a[j]];
      if (we[i][j]) ++t[v].siz;
    }
  }
  dfs(1);
  s = "";
  v = 1;
  for (int i = 1; i <= 5000; ++i) {
    k = k + t[t[v].go[1]].siz + t[t[v].go[0]].siz - t[v].siz;
    if (k < 1) break;
    if (k <= t[t[v].go[0]].siz) {
      s += 'a';
      v = t[v].go[0];
    } else {
      s += 'b';
      k -= t[t[v].go[0]].siz;
      v = t[v].go[1];
    }
  }
  cout << s;
  return 0;
}
