Score : $600$ points
There are $N$ people called Person $1$, Person $2$, $\dots$, Person $N$, lined up in a row in the order of $(1,2,\dots,N)$ from the front. Person $i$ is wearing Color $c_i$.
Takahashi repeated the following operation $K$ times: choose two People $i$ and $j$ arbitrarily and swap the positions of Person $i$ and Person $j$.
After the $K$ operations have ended, the color that the $i$-th person from the front is wearing coincided with $c_i$, for every integer $i$ such that $1 \leq i \leq N$.
How many possible permutations of people after the $K$ operations are there? Find the count modulo $998244353$.
Input is given from Standard Input in the following format:
$N$ $K$ $c_1$ $c_2$ $\dots$ $c_N$
Print the answer.
4 1 1 1 2 1
3
Here is a comprehensive list of possible Takahashi's operations and permutations of people after each operation.
3 3 1 1 2
1
Here is an example of a possible sequence of Takahashi's operations.
Note that, during the sequence of operations, the color that the $i$-th person from the front is wearing does not necessarily coincide with $c_i$.
10 4 2 7 1 8 2 8 1 8 2 8
132