fun main(args:Array<String>) {
	val s= readLine()!!
	val k = readLine()!!.toInt()
	
	(0 until k).map {i ->
		(0 until s.length-i).map {j->
			s.substring(j..j+i)
		}
	}.flatten().distinct().sorted().let { println(it[k-1]) }
}