{"raw_statement":[{"iden":"problem statement","content":"Let us define $\\mathrm{mex}(x_1, x_2, x_3, \\dots, x_k)$ as the smallest non-negative integer that does not occur in $x_1, x_2, x_3, \\dots, x_k$.  \nYou are given an integer sequence of length $N$: $A = (A_1, A_2, A_3, \\dots, A_N)$.  \nFor each integer $i$ such that $0 \\le i \\le N - M$, we compute $\\mathrm{mex}(A_{i + 1}, A_{i + 2}, A_{i + 3}, \\dots, A_{i + M})$. Find the minimum among the results of these $N - M + 1$ computations."},{"iden":"constraints","content":"*   $1 \\le M \\le N \\le 1.5 \\times 10^6$\n*   $0 \\le A_i \\lt N$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $A_2$ $A_3$ $\\dots$ $A_N$"},{"iden":"sample input 1","content":"3 2\n0 0 1"},{"iden":"sample output 1","content":"1\n\nWe have:\n\n*   for $i = 0$: $\\mathrm{mex}(A_{i + 1}, A_{i + 2}) = \\mathrm{mex}(0, 0) = 1$\n*   for $i = 1$: $\\mathrm{mex}(A_{i + 1}, A_{i + 2}) = \\mathrm{mex}(0, 1) = 2$\n\nThus, the answer is the minimum among $1$ and $2$, which is $1$."},{"iden":"sample input 2","content":"3 2\n1 1 1"},{"iden":"sample output 2","content":"0\n\nWe have:\n\n*   for $i = 0$: $\\mathrm{mex}(A_{i + 1}, A_{i + 2}) = \\mathrm{mex}(1, 1) = 0$\n*   for $i = 1$: $\\mathrm{mex}(A_{i + 1}, A_{i + 2}) = \\mathrm{mex}(1, 1) = 0$"},{"iden":"sample input 3","content":"3 2\n0 1 0"},{"iden":"sample output 3","content":"2\n\nWe have:\n\n*   for $i = 0$: $\\mathrm{mex}(A_{i + 1}, A_{i + 2}) = \\mathrm{mex}(0, 1) = 2$\n*   for $i = 1$: $\\mathrm{mex}(A_{i + 1}, A_{i + 2}) = \\mathrm{mex}(1, 0) = 2$"},{"iden":"sample input 4","content":"7 3\n0 0 1 2 0 1 0"},{"iden":"sample output 4","content":"2"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}