Gats and the Lonely Charms
Gats has a string carrying charms in a fixed left-to-right order. The color of the -th charm is .
There are gaps between consecutive charms. Gats selects exactly distinct gaps uniformly at random from all such selections and cuts the string at those gaps. This creates exactly nonempty pieces. When , no gap is selected.
For a piece , a color is called lonely in if exactly one charm of that color belongs to . Let be the number of lonely colors in . The score of the complete cutting is
where the sum is over all pieces.
Find the expected value of .
Input
The first line contains two integers and (), the number of charms and the required number of pieces.
The second line contains integers (), where is the color of the -th charm.
Output
Print one integer: the expected total score modulo .
Formally, if the expected score is the reduced fraction , print , where is the multiplicative inverse of modulo . The required inverse is guaranteed to exist.
Samples
Sample 1
Input
4 2 1 2 1 3
Output
665496242
There are three possible cut locations. They produce total scores , , and , so the expected score is . Its value modulo is .