instr = input().split() res = [] n,k, chr= int(instr.pop(0)), int(instr.pop(-1)), str(instr.pop(-1)) for i,c in enumerate(instr): if c != chr and sorted(c) == sorted(chr): res.append(c) res.sort() print(len(res)) if k <= len(res) and res[k-1]: print(res[k-1])