{"raw_statement":[{"iden":"problem statement","content":"You are given integers $N$ and $K$. Consider a sequence $a=(a_1,a_2,\\dots,a_K)$ of length $K$ that satisfies all of the following conditions:\n\n*   $a_i$ is an integer such that $1 \\le a_i \\le N$.\n*   All elements in $a$ are different.\n\nLet us arrange all possible sequences $a$ in lexicographical order to form a \"sequence of sequences\" called the dictionary $s$.\nGiven a sequence $P$ that exists in the dictionary $s$, answer the following question for each integer $t=1,2,\\dots,N$:\n\n*   Find the number, modulo $998244353$, of sequences $b$ that satisfy all of the following conditions:\n    *   The sequence $b$ exists in the dictionary $s$.\n    *   The integer $t$ is contained in the sequence $b$.\n    *   The sequence $b$ is lexicographically less than or equal to the sequence $P$.\n\nWhat is lexicographical order for sequences? A sequence $A = (A_1, \\ldots, A_{|A|})$ is **lexicographically strictly less** than $B = (B_1, \\ldots, B_{|B|})$ if and only if 1. or 2. below is satisfied:\n\n1.  $|A|<|B|$ and $(A_{1},\\ldots,A_{|A|}) = (B_1,\\ldots,B_{|A|})$.\n2.  There is an integer $1\\leq i\\leq \\min{|A|,|B|}$ that satisfies both of the following:\n    *   $(A_{1},\\ldots,A_{i-1}) = (B_1,\\ldots,B_{i-1})$\n    *   $A_i < B_i$"},{"iden":"constraints","content":"*   All input values are integers.\n*   $1 \\le K \\le N \\le 3 \\times 10^5$\n*   $P$ satisfies the condition in the problem statement."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $K$\n$P_1$ $P_2$ $\\dots$ $P_K$"},{"iden":"sample input 1","content":"4 2\n3 2"},{"iden":"sample output 1","content":"5\n5\n4\n2\n\nIn this input, $N=4,K=2$.  \nHere, the dictionary $s$ is $((1,2),(1,3),(1,4),(2,1),(2,3),(2,4),(3,1),(3,2),(3,4),(4,1),(4,2),(4,3))$.\nAmong the sequences in the dictionary $s$ that are lexicographically less than or equal to $(3,2)$,\n\n*   five sequences contain $1$: $(1,2),(1,3),(1,4),(2,1),(3,1)$,\n*   five sequences contain $2$: $(1,2),(2,1),(2,3),(2,4),(3,2)$,\n*   four sequences contain $3$: $(1,3),(2,3),(3,1),(3,2)$,\n*   two sequences contain $4$: $(1,4),(2,4)$."},{"iden":"sample input 2","content":"18 13\n5 13 11 2 18 1 10 15 17 4 12 7 3"},{"iden":"sample output 2","content":"925879409\n905921009\n665544804\n665544719\n783035803\n349952762\n349952758\n349952757\n349952757\n349921178\n212092637\n710350150\n378895603\n129113201\n129111892\n129098081\n129096772\n110181652"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}