word_list  = input().split(' ')
brother_list = []
for i in range(int(word_list[0])):
    if sorted(word_list[i+1]) == sorted(word_list[-2]) and word_list[i+1] != word_list[-2]:
        brother_list.append(word_list[i+1])
brother_list = sorted(brother_list)
print(len(brother_list))
try:
    print(brother_list[int(word_list[-1])-1])   
except:
    pass