# from collections import Counter def counter(word: str): cnt = [0 for _ in range(26)] for char in word: cnt[ord(char) - ord("a")] += 1 return cnt if __name__ == "__main__": line = list(input().strip().split()) n = int(line[0]) k = int(line[-1]) x = line[-2] words = list(line[1:-2]) bros = list() for word in words: if word != x and sorted(word) == sorted(x): bros.append(word) bros.sort() print(len(bros)) if len(bros) >= k: print(bros[k - 1])