d = input().split() x = d[-2] l = [] min = int(d[-1]) - 1 for s in d[1:-2]: if sorted(s) == sorted(x) and s != x: l.append(s) l.sort() print(len(l)) if len(l) >= min and l: print(l[min])