import sys



input = sys.stdin.readline





def main():

    S = input().strip()

    K = int(eval(input()))



    dic = []

    for i in range(len(S)):

        j = 0

        tmp = ""

        while i + j < len(S) and j < 5:

            tmp += S[i + j]

            if tmp not in dic:

                dic.append(tmp)

            j += 1



    dic.sort()

    print((dic[K - 1]))







    

    

    





if __name__ == '__main__':

    main()

import sys



input = sys.stdin.readline





def main():

    S = input().strip()

    K = int(eval(input()))



    dic = []

    dic_set = set()

    for i in range(len(S)):

        j = 0

        tmp = ""

        while i + j < len(S) and j < 5:

            tmp += S[i + j]

            if tmp not in dic_set:

                dic.append(tmp)

                dic_set.add(tmp)

            j += 1



    dic.sort()

    print((dic[K - 1]))





if __name__ == '__main__':

    main()

import sys

input = sys.stdin.readline


def main():
    S = input().strip()
    K = int(eval(input()))
    dic = []
    for i in range(len(S)):
        j = 0
        tmp = ""
        while i + j < len(S) and j < 5:
            tmp += S[i + j]
            if tmp not in dic:
                dic.append(tmp)
            j += 1
    dic.sort()
    print((dic[K - 1]))


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline


def main():
    S = input().strip()
    K = int(eval(input()))
    dic = []
    dic_set = set()
    for i in range(len(S)):
        j = 0
        tmp = ""
        while i + j < len(S) and j < 5:
            tmp += S[i + j]
            if tmp not in dic_set:
                dic.append(tmp)
                dic_set.add(tmp)
            j += 1
    dic.sort()
    print((dic[K - 1]))


if __name__ == "__main__":
    main()

+    dic_set = set() -            if tmp not in dic: +            if tmp not in dic_set: +                dic_set.add(tmp)