class HelloWorld {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.nextLine();
String[] sp = s.split(" ");
String[] src = new String[Integer.parseInt(sp[0])];
for (int i = 0; i < src.length; i++) {
src[i] = sp[i + 1];
}
String fstr = sp[sp.length - 2];
int out = Integer.parseInt(sp[sp.length - 1]);
int[] aa = new int[26];
// 数组对目标串字符统计
for (int i = 0; i < fstr.length(); i++) {
aa[fstr.charAt(i)-'a']++;
}
List<String> list = new ArrayList<>();
for (int i = 0; i < src.length; i++) {
if (src[i].equals(fstr) || (src[i].length() != fstr.length())) {
continue;
} else {
//数组对查询串字符统计
int []tp = new int[26];
for (int j = 0; j < fstr.length(); j++) {
tp[src[i].charAt(j)-'a']++;
}
boolean f = true;
//二者进行对比 符合加入到集合中
for (int j = 0; j < tp.length; j++) {
if (tp[j]!=aa[j]) {
f = false;
break;
}
}
if (f) {
list.add(src[i]);
}
}
}
String[] arrs = list.toArray(new String[0]);
// 对集合排序
Arrays.sort(arrs);
System.out.println(Arrays.toString(arrs));
System.out.println(arrs.length);
if ((out - 1) < arrs.length) {
System.out.println(arrs[out - 1]);
}
}
}