import java.util.Scanner

import scala.collection.mutable.ListBuffer

object Main {
  val sc = new Scanner(System.in)

  def main(args: Array[String]): Unit = {
    taskC
  }

  def taskA: Unit = {
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val d = sc.nextInt()

    def abs(x: Int): Int = Math.abs(x)
    val ans = if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d) {
      "Yes"
    } else {
      "No"
    }
    println(ans)
  }

  def taskB: Unit = {
    val x = sc.nextInt()

    def isPow(x: Int): Boolean = {
      if (x == 1) {
        true
      } else {
        Range(2, x).exists(i => {
          var t = x
          var cnt = 0
          while (t % i == 0) {
            t /= i
            cnt += 1
          }
          cnt >= 2 && t == 1
        })
      }
    }

    val ans = Range(1, x + 1).reverse.filter(isPow).head
    println(ans)
  }

  def taskC: Unit = {
    val s = sc.next().toCharArray()
    val k = sc.nextInt() - 1
    val n = s.length
    val list = for (i <- Range(0, n); j <- Range(i + 1, n + 1)) yield {
      s.subSequence(i, j).toString
    }
    println(list.sorted.distinct.apply(k))
  }
}