w = input().strip().split()
# a兄弟单词,b需要查找的数,c输入的总单词数,d需要排查的单词数
a, b = w[-2], int(w[-1])
c, d = int(w[0]), w[1:-2]
# 存放兄弟词
e = []
for i in d:
    if i != a and sorted(a) == sorted(i):
        e.append(i)
print(len(e))
try:
    print(sorted(e)[b-1])
except:
    exit()