Problem: The Berland Army is preparing for a large military parade. It is already decided that the soldiers participating in it will be divided into rows, and all rows will contain the same number of soldiers.
Of course, not every arrangement of soldiers into rows is suitable. Heights of all soldiers in the same row should not differ by more than . The height of each soldier is an integer between and .
For each possible height, you know the number of soldiers having this height. To conduct a parade, you have to choose the soldiers participating in it, and then arrange all of the chosen soldiers into rows so that both of the following conditions are met:
- each row has the same number of soldiers,
- no row contains a pair of soldiers such that their heights differ by or more.
Calculate the maximum number of soldiers who can participate in the parade.
Input Format: The first line contains one integer () — the number of test cases. Then the test cases follow.
Each test case begins with a line containing two integers and (, ) — the number of different heights of soldiers and the number of rows of soldiers in the parade, respectively.
The second (and final) line of each test case contains integers , , ..., (), where is the number of soldiers having height in the Berland Army.
It is guaranteed that the sum of over all test cases does not exceed .
Output Format: For each test case, print one integer — the maximum number of soldiers that can participate in the parade.
Note: Explanations for the example test cases:
- the heights of soldiers in the rows can be: , , , (each list represents a row);
- all soldiers can march in the same row;
- soldiers with height in each of rows;
- all soldiers can march in the same row;
- all soldiers with height and can march in the same row.