import sys

from string import ascii_lowercase as AL



input = sys.stdin.readline





def main():

    S = input().rstrip()

    K = int(eval(input()))



    N = len(S)

    sub = set()

    for al in AL:

        for i in range(N):

            if S[i] == al:

                for j in range(1, 6):

                    sub.add(S[i:i + j])

        if len(sub) >= K:

            break



    sub = sorted(sub)

    ans = sub[K - 1]



    print(ans)





if __name__ == "__main__":

    main()

import sys



input = sys.stdin.readline





def main():

    S = input().rstrip()

    K = int(eval(input()))



    N = len(S)

    sub = set()

    for i in range(N):

        for j in range(1, K + 1):

            sub.add(S[i:i + j])



    sub = sorted(sub)

    ans = sub[K - 1]



    print(ans)





if __name__ == "__main__":

    main()

import sys
from string import ascii_lowercase as AL

input = sys.stdin.readline


def main():
    S = input().rstrip()
    K = int(eval(input()))
    N = len(S)
    sub = set()
    for al in AL:
        for i in range(N):
            if S[i] == al:
                for j in range(1, 6):
                    sub.add(S[i : i + j])
        if len(sub) >= K:
            break
    sub = sorted(sub)
    ans = sub[K - 1]
    print(ans)


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()
    K = int(eval(input()))
    N = len(S)
    sub = set()
    for i in range(N):
        for j in range(1, K + 1):
            sub.add(S[i : i + j])
    sub = sorted(sub)
    ans = sub[K - 1]
    print(ans)


if __name__ == "__main__":
    main()

-from string import ascii_lowercase as AL -    for al in AL: -        for i in range(N): -            if S[i] == al: -                for j in range(1, 6): -                    sub.add(S[i : i + j]) -        if len(sub) >= K: -            break +    for i in range(N): +        for j in range(1, K + 1): +            sub.add(S[i : i + j])