{"raw_statement":[{"iden":"problem statement","content":"You are given an integer sequence $A = (A_1, \\dots, A_N)$ of length $N$.\nFind the number, modulo $998244353$, of permutations $P = (P_1, \\dots, P_N)$ of $(1, 2, \\dots, N)$ such that:\n\n*   there exist exactly $K$ integers $i$ between $1$ and $(N-1)$ (inclusive) such that $A_{P_i} \\lt A_{P_{i + 1}}$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 5000$\n*   $0 \\leq K \\leq N - 1$\n*   $1 \\leq A_i \\leq N \\, (1 \\leq i \\leq 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$A_1$ $\\ldots$ $A_N$"},{"iden":"sample input 1","content":"4 2\n1 1 2 2"},{"iden":"sample output 1","content":"4\n\nFour permutations satisfy the condition: $P = (1, 3, 2, 4), (1, 4, 2, 3), (2, 3, 1, 4), (2, 4, 1, 3)$."},{"iden":"sample input 2","content":"10 3\n3 1 4 1 5 9 2 6 5 3"},{"iden":"sample output 2","content":"697112"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}