๐ ์ฒ์์ ํ๋ ค์ ์ฐพ์๋ณด๋ ํ๋ฒ์ ์ซ์๋ก ๋ฐ์์ ๊ทธ๋ ๋ค. '01234' ์ ๊ฒฝ์ฐ 1234๊ฐ ๋๊ธฐ ๋๋ฌธ์ ๋ฌธ์์ด๋ก ๋ฐ์์ผํ๋ค.
์ฝ๋
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');
const [K, L] = input.shift().split(" ").map(Number);
const map = new Map();
for (let student of input) {
if (map.has(student)) {
map.delete(student);
map.set(student, 0);
} else map.set(student, 0);
}
const arr = new Array(...map).map((el) => el[0]);
if (arr.length >= K) console.log(arr.splice(0, K).join("\n"));
else console.log(arr.join("\n"));