def main():

    import sys

    input = sys.stdin.readline

    s = str(input().rstrip('\n'))

    k = int(input().rstrip('\n'))

    d = []

    for i in range(len(s)):

        for j in range(i + 1, min(i + 1 + k, len(s) + 1)):

            d.append(s[i:j])

    import collections

    d = sorted(collections.Counter(d).most_common())

    print((d[k-1][0]))





if __name__ == '__main__':

    main()

def slove():

    import sys

    import collections

    input = sys.stdin.readline

    t = str(input().rstrip('\n'))

    s = collections.Counter(t).most_common()

    k = int(input().rstrip('\n'))

    s.sort()

    d = {}

    for key, v in s:

        for i in range(len(t)):

            if t[i] == key:

                for j in range(i + 1, i + 6):

                    d[t[i:j]] = 1

        if len(d) >= k:

            print((sorted(d.items())[k-1][0]))

            exit()





if __name__ == '__main__':

    slove()

def main():
    import sys

    input = sys.stdin.readline
    s = str(input().rstrip("\n"))
    k = int(input().rstrip("\n"))
    d = []
    for i in range(len(s)):
        for j in range(i + 1, min(i + 1 + k, len(s) + 1)):
            d.append(s[i:j])
    import collections

    d = sorted(collections.Counter(d).most_common())
    print((d[k - 1][0]))


if __name__ == "__main__":
    main()

def slove():
    import sys
    import collections

    input = sys.stdin.readline
    t = str(input().rstrip("\n"))
    s = collections.Counter(t).most_common()
    k = int(input().rstrip("\n"))
    s.sort()
    d = {}
    for key, v in s:
        for i in range(len(t)):
            if t[i] == key:
                for j in range(i + 1, i + 6):
                    d[t[i:j]] = 1
        if len(d) >= k:
            print((sorted(d.items())[k - 1][0]))
            exit()


if __name__ == "__main__":
    slove()

-def main(): +def slove(): +    import collections -    s = str(input().rstrip("\n")) +    t = str(input().rstrip("\n")) +    s = collections.Counter(t).most_common() -    d = [] -    for i in range(len(s)): -        for j in range(i + 1, min(i + 1 + k, len(s) + 1)): -            d.append(s[i:j]) -    import collections - -    d = sorted(collections.Counter(d).most_common()) -    print((d[k - 1][0])) +    s.sort() +    d = {} +    for key, v in s: +        for i in range(len(t)): +            if t[i] == key: +                for j in range(i + 1, i + 6): +                    d[t[i:j]] = 1 +        if len(d) >= k: +            print((sorted(d.items())[k - 1][0])) +            exit() -    main() +    slove()