You are given a directed graph which is constructed as follows:
Additionally, you are given m different colors to color the vertices. Your task is to calculate the number of different colored graphs that can be made.
Two colored graphs A and B are considered the same if and only if there exists a mapping P between their sets of vertices which satisfies the following constraints:
Print the answer modulo 109+7.
The first line of the input contains two space-seperated integers n and m (3≤n≤105, 1≤m≤109), representing the number of vertices in the graph and the number of colors you have.
Then, n lines follow. The i-th of them contains an integer f_i (1≤f_i≤n, f_i=i), denoting a directed edge from vertex i to vertex f_i in the given graph.
Print a single line containing the answer.