from sys import stdin

from string import ascii_lowercase





def main():

    s = stdin.readline().rstrip()

    K = int(stdin.readline().rstrip())

    result = []

    for c in ascii_lowercase:

        for text in sorted([s[i:] for i, x in enumerate(s) if x == c]):

            for i in range(len(text)):

                if not text[:i + 1] in result:

                    result.append(text[:i + 1])

                    if len(result) == K:

                        print((result[-1]))

                        return





if __name__ == '__main__':

    main()

from sys import stdin





def main():

    s = stdin.readline().rstrip()

    K = int(stdin.readline().rstrip())

    result = set()

    for c in sorted(list(set(s))):

        for x in sorted([s[i:] for i, x in enumerate(s) if x == c]):

            for y in [x[:j + 1] for j in range(len(x))]:

                result.add(y)

                if len(result) == K:

                    print((sorted(list(result))[-1]))

                    return





if __name__ == '__main__':

    main()

from sys import stdin
from string import ascii_lowercase


def main():
    s = stdin.readline().rstrip()
    K = int(stdin.readline().rstrip())
    result = []
    for c in ascii_lowercase:
        for text in sorted([s[i:] for i, x in enumerate(s) if x == c]):
            for i in range(len(text)):
                if not text[: i + 1] in result:
                    result.append(text[: i + 1])
                    if len(result) == K:
                        print((result[-1]))
                        return


if __name__ == "__main__":
    main()

from sys import stdin


def main():
    s = stdin.readline().rstrip()
    K = int(stdin.readline().rstrip())
    result = set()
    for c in sorted(list(set(s))):
        for x in sorted([s[i:] for i, x in enumerate(s) if x == c]):
            for y in [x[: j + 1] for j in range(len(x))]:
                result.add(y)
                if len(result) == K:
                    print((sorted(list(result))[-1]))
                    return


if __name__ == "__main__":
    main()

-from string import ascii_lowercase -    result = [] -    for c in ascii_lowercase: -        for text in sorted([s[i:] for i, x in enumerate(s) if x == c]): -            for i in range(len(text)): -                if not text[: i + 1] in result: -                    result.append(text[: i + 1]) -                    if len(result) == K: -                        print((result[-1])) -                        return +    result = set() +    for c in sorted(list(set(s))): +        for x in sorted([s[i:] for i, x in enumerate(s) if x == c]): +            for y in [x[: j + 1] for j in range(len(x))]: +                result.add(y) +                if len(result) == K: +                    print((sorted(list(result))[-1])) +                    return