def main():

    s = eval(input())

    K = int(eval(input()))

    print((sorted({s[i:j]

                  for i in range(len(s))

                  for j in range(i + 1, min(i + K + 1, len(s) + 1))})[K - 1]))

    return





main()

def main():

    s = eval(input())

    K = int(eval(input()))

    lst = sorted(set(s))

    ans = []



    def dfs(c):

        ans.append(c)

        if len(ans) < K:

            for li in lst:

                if c + li in s:

                    return dfs(c + li)



    for li in lst:

        dfs(li)

    print((ans[K - 1]))

    return





main()

def main():
    s = eval(input())
    K = int(eval(input()))
    print(
        (
            sorted(
                {
                    s[i:j]
                    for i in range(len(s))
                    for j in range(i + 1, min(i + K + 1, len(s) + 1))
                }
            )[K - 1]
        )
    )
    return


main()

def main():
    s = eval(input())
    K = int(eval(input()))
    lst = sorted(set(s))
    ans = []

    def dfs(c):
        ans.append(c)
        if len(ans) < K:
            for li in lst:
                if c + li in s:
                    return dfs(c + li)

    for li in lst:
        dfs(li)
    print((ans[K - 1]))
    return


main()

-    print( -        ( -            sorted( -                { -                    s[i:j] -                    for i in range(len(s)) -                    for j in range(i + 1, min(i + K + 1, len(s) + 1)) -                } -            )[K - 1] -        ) -    ) +    lst = sorted(set(s)) +    ans = [] + +    def dfs(c): +        ans.append(c) +        if len(ans) < K: +            for li in lst: +                if c + li in s: +                    return dfs(c + li) + +    for li in lst: +        dfs(li) +    print((ans[K - 1]))