AtCoder Regular Contest 146
F
Simple Solitaire
AtCoder
未评级
原题
← E→
翻译中…

Problem Statement

翻译中…

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 a boy called PCT, who initially has nothing. PCT does the following procedure for each $i=1,2,\dots,N$ in this order.

  • Get Card $i$. Then, repeat the following action as long as he has a card with $X$ written on it:
  • If PCT currently has $M$ or more cards, throw away all cards he has and terminate the process, without performing any more procedures.
翻译中…

Here, let us define the score of the permutation $P$ as follows:

翻译中…
  • if the process is terminated by throwing away cards, the score of $P$ is $0$;
  • 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 $)$.
翻译中…

There are $N!$ permutations $P$ of $(1,2,\dots,N)$. Find the sum of the scores of all those permutations, modulo $998244353$.

翻译中…

Constraints

翻译中…
  • $2 \le N \le 2 \times 10^5$
  • $2 \le M \le N$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N M

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3 2
Output #1
1
For $P=(3,1,2)$, the process goes as follows. - The first procedure: - PCT gets Card $1$. - PCT currently has $1$ card, so he goes on. - The second procedure: - PCT gets Card $2$. - PCT eats Card $2$ and make $X = 2$. - PCT currently has $1$ card, so he goes on. - The third procedure: - PCT gets Card $3$. - PCT eats Cards $1,3$ and make $X = 4$. - PCT currently has $0$ cards, so he goes on. The process is carried out through the end, so the score of $(3,1,2)$ is $1 \times 1 = 1$. Other than $(3,1,2)$, there is no permutation with a score of $1$ or greater, so the answer is $1$.
Input #2
3 3
Output #2
5
Input #3
146146 146
Output #3
103537573
题目信息
题号
arc146_f
时间限制
10 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。