#简单题不解释 import sys data=sys.stdin.readlines() l=data[0].split(" ") n=int(l[0]) # print(n) dic=l[1:n+1] key=l[n+1] # print('dic:',len(dic)) # print(key) for item in dic: if item==key: dic.remove(item) # print('dic:',len(dic)) def isbrother(a,b): if sorted(a)==sorted(b): return True else: return False result=[] for i in range(len(dic)): if isbrother(key,dic[i]): result.append(dic[i]) result=sorted(result) k=int(l[-1].strip("\n")) print(len(result)) if k-1<len(result): print(result[k-1])