


The first line of the input contains a single integer 'T', representing the number of test cases.
The first line of each test case contains two integers ‘N’ and ‘S’ denoting the number of coins and the number of slots respectively.
The second line contains an integer array denoting the value of coins.
Number of coins, N = 9
Number of slots, S = 8
Coins array, COINS = [14, 7, 9, 8, 2, 4, 1, 1, 1, 9]
One possible placement is to put coins having value:
[14, 7] into slot number 7,
[9, 8] into slot number 8,
[2] into slot number 2,
[4] into slot number 4,
[1, 1] into slot number 3,
[1, 9] into slot number 1.
This gives the maximum AND sum of :
(14 AND 7) + (7 AND 7) + (9 AND 8) + (8 AND 8) + (2 AND 2) + (4 AND 3) + (11 AND 3) + (1 AND 9) = 6 + 7 + 8 + 8 + 2 + 4 + 3 + 1 + 1 = 40.
Note that slots number 5, 6 are empty which is permitted.
For each test case, output a single integer , AND sum between the coins and the slots.
Print the output of each test case in a new line.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= S <= 9
1 <= N <= 2 * S
1 <= COINS[i] <= 15
Time Limit: 5 sec