#include <iostream>
#include <string>
#include <list>
#include <cstring>

int main(void) {
  int K;

  std::string str;

  std::string s_;
  std::cin >> s_;
  const char* s = s_.c_str();

  std::cin >> str;
  K = std::stoi(str);

  size_t lsize = 0;
  std::list<std::string> wlist;
  size_t len = s_.length();

  auto itr_ = wlist.begin();
  wlist.push_back(s_.substr(0, 1));
  for (int a = 'a'; a <= 'z' && lsize < K; ++a) {        /* a to z   */
    for (int i = 0; i < len; ++i) {         /* 0 to len */
      if (s[i] == a) {
        for (int j = 0; j < len - 0; ++j) { /* i to len */
          for (auto itr = wlist.begin(); itr != wlist.end(); ++itr) {
            int cmp = s_.compare(i, j, *itr);
            if (cmp == 0) {
              break;
            }
            if (cmp < 0) {
              wlist.insert(itr, s_.substr(i, j));
              lsize++;
              break;
            }
            if (cmp > 0 && itr->c_str() == wlist.rbegin()->c_str()) {
              wlist.push_back(s_.substr(i, j));
              lsize++;
              break;
            }
          }
        }
      }
    }
  }

  size_t idx = 0;
  for (auto &str : wlist) {
    idx++;
    //if (idx == K) {
      std::cout << str << std::endl;
   // }
  }

  return 0;
}