import sys

def input():

  return sys.stdin.readline().rstrip()



S=eval(input())

K=int(eval(input()))



vec=[]

for i in range(len(S)):

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

    tmp=S[i:j]

    if not tmp in vec:

      vec.append(tmp)

vec.sort()



print((vec[K-1]))

import sys

def input():

  return sys.stdin.readline().rstrip()



S=eval(input())

K=int(eval(input()))



vec=set()



for i in range(len(S)):

  for j in range(i+1,min(len(S)+1,K+i+1)):

    tmp=S[i:j]

    vec.add(tmp)

vec=list(vec)

vec.sort()



print((vec[K-1]))

import sys


def input():
    return sys.stdin.readline().rstrip()


S = eval(input())
K = int(eval(input()))
vec = []
for i in range(len(S)):
    for j in range(i + 1, K + i + 1):
        tmp = S[i:j]
        if not tmp in vec:
            vec.append(tmp)
vec.sort()
print((vec[K - 1]))

import sys


def input():
    return sys.stdin.readline().rstrip()


S = eval(input())
K = int(eval(input()))
vec = set()
for i in range(len(S)):
    for j in range(i + 1, min(len(S) + 1, K + i + 1)):
        tmp = S[i:j]
        vec.add(tmp)
vec = list(vec)
vec.sort()
print((vec[K - 1]))

-vec = [] +vec = set() -    for j in range(i + 1, K + i + 1): +    for j in range(i + 1, min(len(S) + 1, K + i + 1)): -        if not tmp in vec: -            vec.append(tmp) +        vec.add(tmp) +vec = list(vec)