Challenges

Floating Number
Bob has a floating point number N. He wants to set the precision for 2...
Max. Marks: 4
Solved By : 3820
SwapMaster solves Symmetric Swap
The SwapMaster is known to be the greatest and fastest swapper of all ...
Max. Marks: 4
Solved By : 3582
String Matching
Cody has a sequence of characters N. He likes a sequence if it contain...
Max. Marks: 3
Solved By : 1835
Leap Year
Steve is playing a quiz game with his brother John. As Steve just lear...
Max. Marks: 6
Solved By : 2896
Project Teams
There are N students in a class and Teacher want to divide these stude...
Max. Marks: 5
Solved By : 3755
Circle of Numbers
All numbers in NumberLand are standing in a circle for a dancing cerem...
Max. Marks: 6
Solved By : 2597
Happy String
A happy string is a string in which each character is lexicographicall...
Max. Marks: 4
Solved By : 1902
Degree Celsius
Tom is a scientist. He uses huge machines for complex calculations. Th...
Max. Marks: 4
Solved By : 4365
Three's Company
This problem requires you to create a output string from input string ...
Max. Marks: 4
Solved By : 2912
Array Sum
You are given an integer array and you have to find the sum of the ele...
Max. Marks: 4
Solved By : 3003
Sliding Window
Please select a challenge
Problem Statement
There is a road of N blocks and at each block, there is tree represented by a number. Groot is standing at the 1st block and he can see only K blocks ahead of him(including the standing block) and he starts walking block by block. Print distinct number of trees visible to Groot at each block. Groot will stop walking when the last tree becomes visible to him.

Input
First Line of the input contains an integer T denoting the number of test cases. The first line of each test case contains N and K. Next Line contains N space separated integers denoting types of tree.

Output
For each test case print visible number of distinct tree at each block separated by space in a separate line.

Constraints
1<=T<=10 1<=N<=100 1<=K<=N.

Sample Input
1
7 4
1 2 1 3 4 2 3

Sample Output

3 4 4 3

Dcoded By: Bhanu Nadar

Solved By: 196

Maximum Marks: 15