import scala.io.StdIn

object Main extends App {

  val s = StdIn.readLine()
  val K = StdIn.readLine().toInt
  
  val m = scala.collection.mutable.Set.empty[String]
  //val m = scala.collection.mutable.SortedSet.empty[String]
  
  // i <- 0 until s.size
  //   j <- 1 until s.size - i
  for(i <- 0 until s.size;
      j <- 1 to s.size - i; if j <= K){
    //println(s"$i $j")
    val temp = s.substring(i, i + j)
    if(!m.contains(temp)){
      m add temp
    }
  }
  
  //println(m.mkString(" "))
  def getK(t: List[String], index: Int): String = {
    if(K == index) t.head
    else getK(t.tail, index + 1)
  }
  println(getK(m.toList.sorted, 1))
}
