Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,len(s)+1):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])


Fixed submission:
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,min(k+i+1,len(s)+1)):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])

Buggy python submission (verdict: Runtime Error):
from numba import njit
@njit("i8(i8)")

def solve(s,k):
  l=[i for i in s]
  ans=l
  mae=[]
  for i in range(len(s)-1):
    nlen=i+1
    for j in range(len(l)-1):
      lj=l[j+1]
      now=l[j]+lj[nlen-1:]
      mae.append(now)

    ans.extend(mae)
    l=mae
    mae=[]

  ans=list(set(ans))
  ans.sort()
  print(ans[k-1])


s=input()
k=int(input())
solve(s,k)

Fixed submission:
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,min(k+i+1,len(s)+1)):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
l=[i for i in s]
ans=[i for i in s]
mae=[]
for i in range(len(s)-1):
  for j in range(len(l)-1):
    nlen=i+1
    lj=l[j+1]
    now=l[j]+lj[nlen-1:]
    mae.append(now)

  ans.extend(mae)
  l=mae
  mae=[]

ans=list(set(ans))
ans.sort()
print(ans[k-1])


Fixed submission:
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,min(k+i+1,len(s)+1)):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
l=[i for i in s]
ans=[i for i in s]
mae=[]
for i in range(len(s)-1):
  for j in range(len(l)-1):
    nlen=len(l[j])
    lj=l[j+1]
    now=l[j]+lj[nlen-1:]
    mae.append(now)
  ans.extend(mae)
  l=mae
  mae=[]

ans=list(set(ans))
ans.sort()
print(ans[k-1])


Fixed submission:
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,min(k+i+1,len(s)+1)):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
l=[i for i in s]
ans=[i for i in s]
mae=[]
for i in range(len(s)-1):
  for j in range(len(l)-1):
    nlen=len(l[j])
    lj=l[j+1]
    now=l[j]+lj[nlen-1:]
    ans.append(now)
    mae.append(now)
  l=mae
  mae=[]

ans=list(set(ans))
ans.sort()
print(ans[k-1])


Fixed submission:
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,min(k+i+1,len(s)+1)):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
l=[i for i in s]
ans=[i for i in s]
for i in range(len(s)-1):
  for j in range(len(l)-1):
    nlen=len(l[j])
    lj=l[j+1]
    now=l[j]+lj[nlen-1:]
    ans.append(now)
  l=ans[len(l)-i:]

ans=list(set(ans))
ans.sort()
print(ans[k-1])


Fixed submission:
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,min(k+i+1,len(s)+1)):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
l=[i for i in s]
ans=[i for i in s]
for i in range(len(s)-1):
  for j in range(len(l)-1):
    nlen=len(l[j])
    lj=l[j+1]
    now=l[j]+lj[nlen-1:]
    ans.append(now)
  l=ans[len(l)-i:]

ans=list(set(ans))
ans.sort()
print(ans[k-1])


Fixed submission:
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,min(k+i+1,len(s)+1)):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])