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)

    total = 0

    for al in AL:

        induces = []

        for i in range(N):

            if al == s[i]:

                induces.append(i)

        if not induces:

            continue

        match = [al]

        for i in range(1, 5):

            for idx in induces:

                if idx + i < N:

                    match.append(s[idx:idx + i + 1])

        match = set(match)

        match = sorted(match)

        if total + len(match) >= K:

            ans = match[K - 1 - total]

            break

        else:

            total += len(match)

    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 = []

    for i in range(N):

        for j in range(K):

            sub.append(s[i:i+j+1])

    sub = set(sub)

    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)
    total = 0
    for al in AL:
        induces = []
        for i in range(N):
            if al == s[i]:
                induces.append(i)
        if not induces:
            continue
        match = [al]
        for i in range(1, 5):
            for idx in induces:
                if idx + i < N:
                    match.append(s[idx : idx + i + 1])
        match = set(match)
        match = sorted(match)
        if total + len(match) >= K:
            ans = match[K - 1 - total]
            break
        else:
            total += len(match)
    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 = []
    for i in range(N):
        for j in range(K):
            sub.append(s[i : i + j + 1])
    sub = set(sub)
    sub = sorted(sub)
    ans = sub[K - 1]
    print(ans)


if __name__ == "__main__":
    main()

-from string import ascii_lowercase as AL -    total = 0 -    for al in AL: -        induces = [] -        for i in range(N): -            if al == s[i]: -                induces.append(i) -        if not induces: -            continue -        match = [al] -        for i in range(1, 5): -            for idx in induces: -                if idx + i < N: -                    match.append(s[idx : idx + i + 1]) -        match = set(match) -        match = sorted(match) -        if total + len(match) >= K: -            ans = match[K - 1 - total] -            break -        else: -            total += len(match) +    sub = [] +    for i in range(N): +        for j in range(K): +            sub.append(s[i : i + j + 1]) +    sub = set(sub) +    sub = sorted(sub) +    ans = sub[K - 1]