#abc247h. [abc247_h]Rearranging Problem

[abc247_h]Rearranging Problem

Problem Statement

There are NN people called Person 11, Person 22, dots\\dots, Person NN, lined up in a row in the order of (1,2,dots,N)(1,2,\\dots,N) from the front. Person ii is wearing Color cic_i.
Takahashi repeated the following operation KK times: choose two People ii and jj arbitrarily and swap the positions of Person ii and Person jj.
After the KK operations have ended, the color that the ii-th person from the front is wearing coincided with cic_i, for every integer ii such that 1leqileqN1 \\leq i \\leq N.
How many possible permutations of people after the KK operations are there? Find the count modulo 998244353998244353.

Constraints

  • 2leqNleq2000002 \\leq N \\leq 200000
  • 1leqKleq1091 \\leq K \\leq 10^9
  • 1leqcileqN1 \\leq c_i \\leq N
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN KK c1c_1 c2c_2 dots\\dots cNc_N

Output

Print the answer.


Sample Input 1

4 1
1 1 2 1

Sample Output 1

3

Here is a comprehensive list of possible Takahashi's operations and permutations of people after each operation.

  • Swap the positions of Person 11 and Person 22, resulting in a permutation (2,1,3,4)(2, 1, 3, 4).
  • Swap the positions of Person 11 and Person 44, resulting in a permutation (4,2,3,1)(4, 2, 3, 1).
  • Swap the positions of Person 22 and Person 44, resulting in a permutation (1,4,3,2)(1, 4, 3, 2).

Sample Input 2

3 3
1 1 2

Sample Output 2

1

Here is an example of a possible sequence of Takahashi's operations.

  • In the 11-st operation, he swaps the positions of Person 11 and Person 33, resulting in a permutation (3,2,1)(3, 2, 1).
    In the 22-nd operation, he swaps the positions of Person 22 and Person 33, resulting in a permutation (2,3,1)(2, 3, 1).
    In the 33-rd operation, he swaps the positions of Person 11 and Person 33, resulting in a permutation (2,1,3)(2, 1, 3).

Note that, during the sequence of operations, the color that the ii-th person from the front is wearing does not necessarily coincide with cic_i.


Sample Input 3

10 4
2 7 1 8 2 8 1 8 2 8

Sample Output 3

132