{"raw_statement":[{"iden":"problem statement","content":"You are given a sequence $P = (p_1,p_2,\\ldots,p_N)$ that contains $1,2,\\ldots,N$ exactly once each.  \nYou may perform the following operations between $0$ and $K$ times in total in any order:\n\n*   Choose one term of $P$ and remove it.\n*   Move the last term of $P$ to the head.\n\nFind the lexicographically smallest $P$ that can be obtained as a result of the operations."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $0 \\leq K \\leq N-1$\n*   $1 \\leq p_i \\leq N$\n*   $(p_1,p_2,\\ldots,p_N)$ contains $1,2,\\ldots,N$ exactly once each.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $K$\n$p_1$ $p_2$ $\\ldots$ $p_N$"},{"iden":"sample input 1","content":"5 3\n4 5 2 3 1"},{"iden":"sample output 1","content":"1 2 3\n\nThe following operations make $P$ equal $(1,2,3)$.\n\n*   Removing the first term makes $P$ equal $(5,2,3,1)$.\n*   Moving the last term to the head makes $P$ equal $(1,5,2,3)$.\n*   Removing the second term makes $P$ equal $(1,2,3)$.\n\nThere is no way to obtain $P$ lexicographically smaller than $(1,2,3)$, so this is the answer."},{"iden":"sample input 2","content":"3 0\n3 2 1"},{"iden":"sample output 2","content":"3 2 1\n\nYou may be unable to perform operations."},{"iden":"sample input 3","content":"15 10\n12 10 7 2 8 11 9 1 6 14 3 15 13 5 4"},{"iden":"sample output 3","content":"1 3 4 7 2 8 11 9"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}