const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
function checkBrother (word, brother) {
const arr = [];
for (let i = 0; i < brother.length; i++) {
if (word !== brother[i] && word.length === brother[i].length){
const letters = [...word];
const keyLetters = [...brother[i]];
letters.sort();
keyLetters.sort();
if (letters.join("") === keyLetters.join("")) {
arr.push(brother[i]);
}
}
}
return arr;
}
void async function () {
// Write your code here
while(line = await readline()){
const splitArr = line.split(" ");
const len = splitArr.shift(); // 去头
const k = splitArr.pop(); // 去尾
const keyword = splitArr.pop(); // 去尾
const family = splitArr;
const result = checkBrother(keyword, family).sort();
console.log(result.length);
if (result.length > k) {
console.log(result[k - 1]);
}
}
}()