#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  string S;
  cin >> S;
  int K;
  cin >> K;
  
  vector<string> part;
  for( int i = 0; i < S.size(); i++ ){
    for( int j = 1; j <= 5; j++ ){
      part.push_back(S.substr(i, j));
    }
  }
  sort(part.begin(), part.end());
  part.erase(unique(part.begin(), part.end()), part.end());
  cout << part.at(K-1) << endl;
}
