As everyone knows, the Legendary Huron loves playing with magnetic sticks of many colors. After finishing his colorful polygon constructions last Saturday, he now wants to store his sticks in boxes.
Legendary Huron owns $$$m$$$ magnetic sticks. Each stick has a color, represented by an integer in the range $$$[0, m-1]$$$. Sticks of the same color are indistinguishable.
He plans to store these sticks in $$$n$$$ distinct boxes. Each stick must be placed in exactly one box.
Once the sticks are distributed, Legendary Huron will hang the boxes in the form of a colorful rooted tree:
Legendary Huron defines the beauty of his arrangement as follows:
Legendary Huron is still undecided about two things:
He wants to know the total sum of beauties of the trees over all possible valid configurations. Two configurations are considered different if:
Note: The boxes are distinct (labeled), but the sticks of the same color are indistinguishable.
The file contains multiple test cases. The first line contains an integer $$$t$$$ $$$(1 \leq t \leq 10^5)$$$ — the number of test cases.
The first line of each test case description contains two integers $$$n$$$ and $$$m$$$ $$$(1 \leq n, m \leq 10^6)$$$.
The following line contains $$$m$$$ integers between $$$0$$$ and $$$m-1$$$, representing the colors of each magnetic stick.
It is guaranteed that the sum of all values of $$$m$$$ over the input does not exceed $$$10^6$$$.
For each test case, answer modulo $$$998244353$$$ — the total sum of beauties of the trees over all possible ways of distributing the sticks and constructing the colorful rooted tree.
31 30 1 22 30 1 23 30 1 2
3 28 351
110 73 0 1 2 0 3 1
335613770