while True:
try:
Lists = input().split() # 按空格拆分为列表
InputCounts = int(Lists[0]) # 获取原列表的总数N
#print(Lists, InputCounts)
ListStr = Lists[1:InputCounts+1] # 获取原列表
#print(ListStr)
OutputCounts = int(Lists[-1]) # 获取K值
#print(OutputCounts)
SearchStr = Lists[-2] # 获取对比的字符串
#print(SearchStr)
ListSame = []
for x in ListStr:
if x != SearchStr and sorted(x) == sorted(SearchStr):
ListSame.append(x)
print(len(ListSame))
SortList = sorted(ListSame)
print(SortList[OutputCounts-1])
except:
break