시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB51353386.842%

문제

There are $N$ toasters, numbered from $1$ to $N$, from left to right. Initially, each toaster has a single piece of bread in it. There are $M$ people, numbered from $1$ to $M$, who are one by one looking for bread among the toasters, starting from person $1$, person $2$, and so on.

Person $i$ starts looking from toaster $a_i$ ($1 ≤ a_i ≤ N$) and keeps going right until they found a toaster with a piece of bread in it. In other words, person $i$ is looking for the smallest $j$ such that $a_i ≤ j ≤ N$ and toaster $j$ contains bread. If such a toaster exists, then person $i$ will take the bread from that toaster and leave; the toaster becomes empty afterward. If such a toaster does not exist, then person $i$ will leave empty-handed.

A starting sequence $(a_1, a_2, \cdots , a_M)$ is fair if person $i$ starts looking from toaster ai and does not leave empty-handed, for all $1 ≤ i ≤ M$. Out of all $N^M$ possible starting sequences, determine how many of them are fair modulo $998\, 244\, 353$.

입력

Input consists of two integers $N$ $M$ ($1 ≤ M ≤ N ≤ 200\, 000$) in a single line representing the number of toasters and the number of people, respectively.

출력

Output an integer in a single line representing the number of fair starting sequence modulo $998\, 244\, 353$.

예제 입력 1

4 3

예제 출력 1

50

One of the possible fair starting sequences is $(4, 2, 2)$. First, person $1$ starts looking from toaster $4$ and takes the bread from toaster $4$. Then, person $2$ starts looking from toaster $2$ and takes the bread from toaster $2$. Finally, person $3$ will start looking from toaster $2$, which is currently empty. Person $3$ moves to toaster $3$ and takes the bread from toaster $3$. Since each person gets a piece of bread, the starting sequence $(4, 2, 2)$ is fair.

Another example of fair starting sequences are $(1, 1, 1)$, $(1, 1, 2)$, $(2, 3, 4)$, and $(2, 2, 2)$. Some of the possible starting sequences that are not fair are $(3, 3, 3)$, $(3, 4, 3)$, $(4, 4, 1)$, and $(4, 4, 4)$.

예제 입력 2

10 1

예제 출력 2

10

All starting sequences are fair.

예제 입력 3

2 2

예제 출력 3

3

The only starting sequence that is not fair is $(2, 2)$. Person $1$ starts looking from toaster $2$ and takes the bread from toaster $2$. Then, person $2$ starts looking from toaster $2$, which is currently empty. Since there is no more toaster to the right of toaster $2$, person $2$ will leave empty-handed.