Buggy python submission (verdict: Time Limit Exceeded):
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(i,N):
    p=s[i:j+1]
    if len(p)<=K:
      tmp.add(p)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])


Fixed submission:
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(K):
    t= s[i:i+j+1]
    #print(i,j,t)
    tmp.add(t)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(i,N):
    p=s[i:j+1]
    if len(p)<=K:
      tmp.add(p)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])


Fixed submission:
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(K):
    t= s[i:i+j+1]
    #print(i,j,t)
    tmp.add(t)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heapify,heappush,heappop

s=input()
K=int(input())
N=len(s)
tmp=[]
heapify(tmp)

for i in range(N):
  for j in range(i,N):
    if len(s[i:j+1])<=K:
      heappush(tmp,s[i:j+1])
  
i=0
zumi=set()
while True:
  s=heappop(tmp)
  if s not in zumi:
    zumi.add(s)
    i += 1
    if i==K:
      print(s)
      exit()



#lis=sorted(tmp)
#print(lis)
#print(lis[K-1])

Fixed submission:
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(K):
    t= s[i:i+j+1]
    #print(i,j,t)
    tmp.add(t)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heapify,heappush,heappop

s=input()
K=int(input())
N=len(s)
tmp=[]
heapify(tmp)

for i in range(N):
  for j in range(i,N):
    heappush(tmp,s[i:j+1])
  
i=0
zumi=set()
while True:
  s=heappop(tmp)
  if s not in zumi:
    zumi.add(s)
    i += 1
    if i==K:
      print(s)
      exit()



#lis=sorted(tmp)
#print(lis)
#print(lis[K-1])

Fixed submission:
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(K):
    t= s[i:i+j+1]
    #print(i,j,t)
    tmp.add(t)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heapify,heappush,heappop

s=input()
K=int(input())
N=len(s)
tmp=[]
heapify(tmp)

for i in range(N):
  for j in range(i,N):
    heappush(tmp,s[i:j+1])
  
i=0
zumi=set()
while True:
  s=heappop(tmp)
  if s not in zumi:
    zumi.add(s)
    i += 1
    if i==K:
      print(s)
      exit()



#lis=sorted(tmp)
#print(lis)
#print(lis[K-1])

Fixed submission:
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(K):
    t= s[i:i+j+1]
    #print(i,j,t)
    tmp.add(t)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(i,N):
    tmp.add(s[i:j+1])
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])

Fixed submission:
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(K):
    t= s[i:i+j+1]
    #print(i,j,t)
    tmp.add(t)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(i,N):
    tmp.add(s[i:j+1])
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])

Fixed submission:
s=input()
K=int(input())
N=len(s)
tmp=set()

for i in range(N):
  for j in range(K):
    t= s[i:i+j+1]
    #print(i,j,t)
    tmp.add(t)
    
lis=sorted(tmp)
#print(lis)
print(lis[K-1])