Loading...
LTS
Time: 1 s
Memory: 125 MB
You are given an array \(a\) of \(n\) integers. Find the maximum count of unique integers after removing exactly \(k\) integers from it.
Input
The first line contains a single integer \(t\) \((1 \leq t \leq 10^5)\) — the number of test cases.
The first line of each test case contains two integers \(n,k\) \((1 \leq n \leq 10^5, 1 \leq k \leq n)\) — the size of the array and the number of integers to remove.
The second line of each test case contains \(n\) integers \(a_1, a_2, \dots, a_n\) \((1 \leq a_i \leq 10^9)\) — the array \(a\).
It is guaranteed that the sum of \(n\) over all test cases doesn't exceed \(2 \cdot 10^5\).
Output
For each test case, print a single integer — the maximum number of unique integers after removing exactly \(k\) integers.
Examples
Input
Output
3
5 1
2 5 2 1 2
5 2
2 5 2 1 2
5 3
2 5 2 1 2
3
3
2
Problem Info
Problem ID 271
Time Limit 1000 ms
Memory Limit 128000 KB
Moderators amirhozaifa , fahimcp495
Statistics
Submit
You need to Login or Registration for submit your solution