line = input().split(" ") n = int(line[0]) x = line[n+1] k = int(line[-1]) ans = [] for i in range(1, 1+n, 1): word = line[i] if word != x and sorted(word) == sorted(x): ans.append(word) print(len(ans)) if len(ans) > k: print(sorted(ans)[k-1])