Given an array A of N integers and a number K. The task is to print the numbers with K frequency.
Input:
First line of input contians number of testcases T. For each testcase, there will be two lines, first of which contains N and K, and next line contains N space seperated integers.
Output:
For each testcase, output the array elements in sorted order which are occurring K times in the array if present, else print -1.
Constraints:
1 <= T <= 100
1 <= N <= 106
1 <= A[i] <= 106
1 <= K <= 106
Example:
Input:
1
5 2
1 2 3 4 1
Output:
1
Explanation:
Testcase 1: In the given array, 1 is present 2 times.
where i am going wrong in my code :-