{"raw_statement":[{"iden":"problem statement","content":"Given are a permutation $P=(P_1,P_2,\\ldots,P_N)$ of $(1,2,\\ldots,N)$ and a positive integer $K$.\nFor each $i=K,K+1,\\ldots,N$, find the following.\n\n*   The $K$\\-th greatest value among the first $i$ terms of $P$."},{"iden":"constraints","content":"*   $1 \\leq K \\leq N \\leq 5 \\times 10^5$\n*   $(P_1,P_2,\\ldots,P_N)$ is a permutation of $(1,2,\\ldots,N)$.\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":"3 2\n1 2 3"},{"iden":"sample output 1","content":"1\n2\n\n*   The $(K=)$ $2$\\-nd greatest value among the first $2$ terms of $P$, $(P_1,P_2)=(1,2)$, is $1$.\n*   The $(K=)$ $2$\\-nd greatest value among the first $3$ terms of $P$, $(P_1,P_2,P_3)=(1,2,3)$, is $2$."},{"iden":"sample input 2","content":"11 5\n3 7 2 5 11 6 1 9 8 10 4"},{"iden":"sample output 2","content":"2\n3\n3\n5\n6\n7\n7"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}