import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

void main() {
  string s = readln.chomp;
  int K = readln.chomp.to!int;
  int[string] h;

  foreach (i; 0..s.length+1) {
    foreach (j; i+1..s.length+1) {
      string sub = s[i..j];
      h[sub] = 0;
    }
  }

  string[] subs = h.keys;
  subs.sort!"a<b";
  writeln(subs[K - 1]);
}
