You are given an array of N numbers A1,A2,…,AN. In one operation, you can pick any index i and change Ai to x(1≤x≤109). Given an integer K, find the minimum number of operations required to make K the mode of the array.
Note: A number is called the mode of the array if it is more frequent than any other number in the array.
Example: The mode of array [1,1,3] is 1. The array [1,1,3,3] does not have any mode.
Input format
Note: Sum of N over all test cases does not exceed 2×105.
Output format
For each test case output a line containing the minimum number of operations required to make K the mode of array A.
Constraints
1≤T≤1000
1≤N≤2×105
1≤K≤109
1≤Ai≤109
Sum of N over all test cases is less than or equal to 2×105
For the first case, we can see that 1 is already the mode of the array.
For the second case, we can choose index 3 and do the operation a3=1. The array will be [1,1,1,3]. Now, 1 is the mode of the array.