s = input().split()
N = int(s[0])
k = int(s[-1])
target = s[-2]
bother_group = s[1:-2]
def is_bother(target, bother):
if len(target) != len(bother) or target == bother:
return False
L = len(target)
x1 =[]
x2 = []
for i in range(L):
x1.append(target[i])
x2.append(bother[i])
x1.sort()
x2.sort()
same_word = 0
for i in range(L):
if x1[i] == x2[i]:
same_word += 1
if same_word == L:
return True
else:
return False
new_bother_group = []
for bother in bother_group:
if is_bother(target, bother):
new_bother_group.append(bother)
new_bother_group.sort()
print(len(new_bother_group))
if k > len(new_bother_group):
pass
else:
print(new_bother_group[k - 1])