{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"FGH 作为机房最强卷王,为了直接卷进 HK ,总是在机房背单词。\n\n每当 FGH 打开一本有 $n$ 个单词的词汇书,他都会从头开始记单词,由于 FGH 虽然很强但并不是天才,他同一时间最多记住 $k$ 个单词,每当看到 FGH 在记满 $k$ 个单词的情况下遇到没记住的单词,FGH 就会忘掉最先记住的单词,来记新单词。由于这些单词书是不同老师下发的,上面可能包含了很多相同单词,每种单词都有一个编号。\n\n请你告诉 FGH 他最后记住了几个单词,并把这些单词的编号输出。\n"}},{"title":"Input","value":{"format":"MD","content":"输入的第一行包含两个整数 $n$ 和 $k$ (1≤n,k≤2e5) -单词书上的单词数和 FGH 同一时间最多记的单词。\n\n输入的第二行包含 $n$ 个整数$id_1,id_2,…,id_n$ $(1≤id_i≤1e9)$,其中 $id_i$ 是单词书第 $i$ 个单词的编号。\n"}},{"title":"Output","value":{"format":"MD","content":"在输出的第一行中,输出一个整数 $m$(1≤m≤min(n,k))-表示最后 FGH 记住的单词数。\n\n在第二行中,输出 $m$ 个整数$id s1,id s2,…,id sm$ ,其中 $id si$ 是 FGH 按照从后到先顺序记住的名词数。\n"}},{"title":"Examples","value":{"format":"MD","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e7 2\n1 2 3 2 1 3 2\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e2\n2 1 \n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e10 4\n2 3 3 1 1 2 1 2 3 3\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e3\n1 3 2 \n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"MD","content":"在第一个样例中,乾神记住的算法编号如下(从先记到后记的顺序):\u003cbr/\u003e\u003cbr/\u003e\n\n[];\u003cbr/\u003e\n[1];\u003cbr/\u003e\n[2,1];\u003cbr/\u003e\n[3,2];\u003cbr/\u003e\n[3,2];\u003cbr/\u003e\n[1,3];\u003cbr/\u003e\n[1,3];\u003cbr/\u003e\n[2,1]。\u003cbr/\u003e\n在第二个示例中:\u003cbr/\u003e\u003cbr/\u003e\n\n[];\u003cbr/\u003e\n[2];\u003cbr/\u003e\n[3,2];\u003cbr/\u003e\n[3,2];\u003cbr/\u003e\n[1,3,2];\u003cbr/\u003e\n然后到最后也不会改变。\u003cbr/\u003e\n"}}]}