object Main extends App {
  var li = Set[String]()
  val s = scala.io.StdIn.readLine()
  val n = scala.io.StdIn.readLine().toInt
  for (i <- 0 to s.length) {
    for (l <- i to s.length) {
      li = li + s.slice(i,l)
    }
  }
  println(li.toList.sorted.drop(1)(n-1))
}