words = input().split() n = int(words.pop(0)) index = int(words.pop()) - 1 brother = words.pop() count = 0 ret = [] for word in words: if len(word) != len(brother): continue is_brother = True for c in brother: if brother.count(c) != word.count(c): is_brother = False break if is_brother and word != brother: ret.append(word) ret.sort() print(ret.__len__()) if index < ret.__len__(): print(ret[index])