atcoder#ARC134C. [ARC134C] The Majority

[ARC134C] The Majority

Score : 500500 points

Problem Statement

There are KK boxes numbered 11 to KK. Initially, all boxes are empty.

Snuke has some balls with integers from 11 to NN written on them. Among them, aia_i balls have the number ii. Balls with the same integer written on them cannot be distinguished.

Snuke has decided to put all of his balls in the boxes. He wants the balls with the number 11 to have a majority in every box. In other words, in every box, the number of balls with 11 should be greater than that of the other balls.

Find the number of such ways to put the balls in the boxes, modulo 998244353998244353.

Two ways are distinguished when there is a pair of integers (i,j)(i,j) satisfying 1iK,1jN1 \leq i \leq K, 1 \leq j \leq N such that the numbers of balls with jj in Box ii are different.

Constraints

  • All values in input are integers.
  • 1N1051 \leq N \leq 10^5
  • 1K2001 \leq K \leq 200
  • 1ai<9982443531 \leq a_i < 998244353

Input

Input is given from Standard Input in the following format:

NN KK

a1a_1 \cdots aNa_N

Output

Print the number of ways, modulo 998244353998244353, to put the balls in the boxes so that the balls with the number 11 have a majority in every box.

2 2
3 1
2
  • There are two ways to put the balls so that the balls with the number 11 will be in the majority.
  • One way to do so is to put two of the balls with 11 in Box 11 and the other one in Box 22, and put the one ball with 22 in Box 11.
2 1
1 100
0
  • There may be no way to put the balls in the boxes to meet the requirement.
20 100
1073813 90585 41323 52293 62633 28788 1925 56222 54989 2772 36456 64841 26551 92115 63191 3603 82120 94450 71667 9325
313918676
  • Be sure to find the count modulo 998244353998244353.