import scala.io.StdIn

object Main extends App {

  val s = StdIn.readLine()
  val K = StdIn.readLine().toInt
  val r = {
    for (i <- 0 until s.size;
         j <- 1 to s.size - i; if j <= K)
      yield s.substring(i, i + j)
  }.distinct.sorted.apply(K - 1)

  println(r)
}
