{"problem":{"name":"Simple Solitaire","description":{"content":"The following process is carried out on a permutation $P$ of $(1,2,\\dots,N)$. > We have $N$ cards, numbered $1$ to $N$. Card $i$ has the integer $P_i$ written on it. > There are an integer $X=1$ and ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":10000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc146_f"},"statements":[{"statement_type":"Markdown","content":"The following process is carried out on a permutation $P$ of $(1,2,\\dots,N)$.\n\n> We have $N$ cards, numbered $1$ to $N$. Card $i$ has the integer $P_i$ written on it.\n> There are an integer $X=1$ and a boy called PCT, who initially has nothing. PCT does the following procedure for each $i=1,2,\\dots,N$ in this order.\n> \n> *   Get Card $i$. Then, repeat the following action as long as he has a card with $X$ written on it:\n> \n> *   eat the card with $X$ written on it, and then add $1$ to $X$.\n> \n> *   If PCT currently has $M$ or more cards, throw away all cards he has and terminate the process, without performing any more procedures.\n\nHere, let us define the score of the permutation $P$ as follows:\n\n*   if the process is terminated by throwing away cards, the score of $P$ is $0$;\n*   if the process is carried out through the end without throwing away cards, the score of $P$ is $\\prod_{i=1}^{N-1}$ $($ the number of cards PCT has at the end of the $i$\\-th procedure $)$.\n\nThere are $N!$ permutations $P$ of $(1,2,\\dots,N)$. Find the sum of the scores of all those permutations, modulo $998244353$.\n\n## Constraints\n\n*   $2 \\le N \\le 2 \\times 10^5$\n*   $2 \\le M \\le N$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc146_f","tags":[],"sample_group":[["3 2","1\n\nFor $P=(3,1,2)$, the process goes as follows.\n\n*   The first procedure:\n    *   PCT gets Card $1$.\n    *   PCT currently has $1$ card, so he goes on.\n*   The second procedure:\n    *   PCT gets Card $2$.\n    *   PCT eats Card $2$ and make $X = 2$.\n    *   PCT currently has $1$ card, so he goes on.\n*   The third procedure:\n    *   PCT gets Card $3$.\n    *   PCT eats Cards $1,3$ and make $X = 4$.\n    *   PCT currently has $0$ cards, so he goes on.\n\nThe process is carried out through the end, so the score of $(3,1,2)$ is $1 \\times 1 = 1$.\nOther than $(3,1,2)$, there is no permutation with a score of $1$ or greater, so the answer is $1$."],["3 3","5"],["146146 146","103537573"]],"created_at":"2026-03-03 11:01:14"}}