시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB87787.500%

문제

There are $n$ nodes, the $i$-th of which has color $c_i$. For a given integer $k$ ($1 \le k \le n$), please count the number of ways to build exactly $n - 1$ undirected edges between the nodes, such that:

  1. The $n$ nodes form a connected graph. 
  2. If we destroy every edge that connects two nodes of different colors, then every connected component in the remaining graph has at most $k$ vertices. 

Two ways of building edges are considered different if and only if there exist two nodes $i$ and $j$ such that $1 \le i < j \le n$ and there is an edge between them in one of the two ways but not in the other.

Since the number could be large, you only need to output the answer modulo $10^9 + 7$.

입력

The first line contains two integers, $n$ and $k$ ($1 \le k \le n \le 300$).

The following $n$ lines contain integers $c_1, c_2, \ldots, c_n$ denoting the colors of the nodes, one integer per line ($1 \le c_i \le n$).

출력

Output the answer modulo $10^9 + 7$.

예제 입력 1

5 3
1
1
3
1
5

예제 출력 1

125

예제 입력 2

4 2
2
1
1
1

예제 출력 2

7