Jewelry

Time Limit: 4000ms
Memory Limit: 262144KB
This problem will be judged on HDU. Original ID: 5722
64-bit integer IO format: %I64d      Java class name: Main

Description

After all the difficulties, Psyche and Cupid are finally getting married.

No ordinary pearls can hold Cupid's love for Psyche. So he has collected the Jewelry of Gods at the top of Mount Olympus to make her a chain.

There are $ n $ beads on the chain. The $ i $-th bead is of the type $ A_i $.

Being pretty in appearance and generous in her heart, Psyche decides to give one consecutive part of the chain to her mother.

To meet her mother's particular taste, that part must have at least one type of bead that appears $ x $ times exactly.

Psyche wants to know the number of ways to choose a part of the chain for her mother.

Note that two parts $[L_1, R_1]$ and $[L_2, R_2]$ are different only if $ L_1 \neq L_2 $ or $ R_1 \neq R_2 $.

Input

The first line of the input contains an integer $ T $ $ (1 \le T \le 15) $, which denotes the number of test cases.

For each test case, the first line contains two integers $ n,x $ $ (1 \le n \le 10 ^ 5, 1 \le x \le n) $.

The second line contains $ n $ integers, the $ i $-th integer denotes $ A_i $ $ (0 \le A_i \le 10 ^ 9) $.

Output

For each test case, print an integer which denotes the number of parts Psyche can choose.

Sample Input

2
3 1
1 2 1
4 2
2 3 2 2

Sample Output

6
3

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .