# 解説



s = eval(input())

k = int(eval(input()))



st = set()

for start in range(len(s)):

    for len_ in range(1, k + 1):

        st.add(s[start:start + len_])

*a, = sorted(st)

print((a[k - 1]))



# 高々k文字

# kが小さいので

# 全列挙してソート

def main():

    S = eval(input())

    N = len(S)

    K = int(eval(input()))



    tank = set()

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

        for i in range(N - k + 1):

            t = S[i:i + k]

            tank.add(t)



    ans = sorted(tank)[K - 1]

    print(ans)





if __name__ == '__main__':

    main()



# import sys

# input = sys.stdin.readline

# 

# sys.setrecursionlimit(10 ** 7)

# 

# (int(x)-1 for x in input().split())

# rstrip()

#

# def binary_search(*, ok, ng, func):

#     while abs(ok - ng) > 1:

#         mid = (ok + ng) // 2

#         if func(mid):

#             ok = mid

#         else:

#             ng = mid

#     return ok

# 解説
s = eval(input())
k = int(eval(input()))
st = set()
for start in range(len(s)):
    for len_ in range(1, k + 1):
        st.add(s[start : start + len_])
(*a,) = sorted(st)
print((a[k - 1]))
# 高々k文字
# kが小さいので
# 全列挙してソート

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


if __name__ == "__main__":
    main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

-# 解説 -s = eval(input()) -k = int(eval(input())) -st = set() -for start in range(len(s)): -    for len_ in range(1, k + 1): -        st.add(s[start : start + len_]) -(*a,) = sorted(st) -print((a[k - 1])) -# 高々k文字 -# kが小さいので -# 全列挙してソート +def main(): +    S = eval(input()) +    N = len(S) +    K = int(eval(input())) +    tank = set() +    for k in range(1, K + 1): +        for i in range(N - k + 1): +            t = S[i : i + k] +            tank.add(t) +    ans = sorted(tank)[K - 1] +    print(ans) + + +if __name__ == "__main__": +    main() +# import sys +# input = sys.stdin.readline +# +# sys.setrecursionlimit(10 ** 7) +# +# (int(x)-1 for x in input().split()) +# rstrip() +# +# def binary_search(*, ok, ng, func): +#     while abs(ok - ng) > 1: +#         mid = (ok + ng) // 2 +#         if func(mid): +#             ok = mid +#         else: +#             ng = mid +#     return ok