# K = list('dp')
# L= int('3')
# S = 'dddppdpd'
K = list(input())
L = int(input())
S = input()
now_string = [ '' ] * L
cut_results = set() # 用集合去做搜尋 能夠更快且避免 TLE
end = False
def dfs(now_position):
global end
if end == True :
return
if now_position == L :
new_string = ''
for i in now_string:
new_string+= i
# print(new_string)
if(new_string not in cut_results):
end = True
print(new_string)
return
for i in K:
now_string[now_position] = i
dfs(now_position+1)
# 先產生 dddppdpd 的所有可能
for i in range(0,len(S),1):
text = S[i:i+L]
if len(text) == L:
cut_results.add(text)
dfs(0)