'use strict'

function main(input) {

    input = input.split('\n')
    let str = input[0]
    let k = ~~input[1]

    let substrings = []

    for (let i = 0; i < str.length; i++) {

        let tmp = '';
        for (let n = i + 1; n <= str.length; n++) {

            tmp = str.substring(i, n)
            substrings.push(tmp)
        }

    }

    let b = substrings.filter((v, i, ary) => {

        return ary.indexOf(v) === i

    })

    console.log(substrings[k + 1])
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));