import scala.io.StdIn._
object Main extends App {
  val s = readLine
  val k = readInt
  var set = Set.empty[String]
  for (i <- 1 to k) {
    s.toSeq
      .sliding(i)
      .foreach(w => {
        set = set + w.mkString
      })
  }

  println((set.toList.sorted)(k - 1))
}
