| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| Hakam Round #1 |
|---|
| Finished |
You are given an array $$$a$$$ of length $$$n$$$ and an integer $$$k$$$. Count the number of different non-empty subsequences of $$$a$$$ with length at most $$$k$$$.
A subsequence is obtained by removing zero or more elements from an array without changing the order of the remaining elements. Two subsequences are different if their lengths differ, or if their values differ at some position. Choosing different indices that give the same sequence of values counts only once.
For example, in the array $$$[1,2,1]$$$, choosing either occurrence of $$$1$$$ gives the same subsequence $$$[1]$$$. The different subsequences of length at most $$$2$$$ are $$$[1]$$$, $$$[2]$$$, $$$[1,2]$$$, $$$[1,1]$$$, and $$$[2,1]$$$, so the answer is $$$5$$$.
Since the answer can be large, print it modulo $$$1000000007$$$.
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$), the number of test cases.
The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 100000$$$, $$$1 \le k \le \min(n,100)$$$).
The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le n$$$).
The sum of $$$n$$$ over all test cases does not exceed $$$100000$$$. There is no additional bound on the sum of $$$k$$$.
For each test case, print the number of different non-empty subsequences of length at most $$$k$$$, modulo $$$1000000007$$$.
43 21 2 13 31 1 14 21 2 3 41 11
53101
| Name |
|---|

