sherlock-holmes

Sherlock Holmes and Dr Watson are solving a case. Dr Watson reaches the crime scene earlier and starts investigating and finds a series of n number written on a sheet of paper in increasing order. But then a guy with a mask comes to the sight and threatens Watson to leave the evidence. Watson is no fighter so he leaves. All he could do is memorize m numbers out of n along with their positions and assumes that Holmes will find out the other numbers by linear interpretation. He tells Holmes about this incident and the numbers and their positions. Holmes interprets every number with some average error.
Watson will always memorize the first and the last number which is inclusive of m. Holmes will interpret a number nk at k^th position between two memorized number ni and nj at i^th and j^th position (i < k < j) respectively by the formula :

nk = ni +  (nj -  ni ).(k-i)/(j-i)

Help Dr Watson to memorize m number out of n such that average error is minimum when interpreted by Holmes.

Input:

Input will consist of t test cases. For each test case there are two lines. The first line contains n and m followed by second line of input specifying n numbers in increasing order.

Output:

For every test case t you have to print the minimum average error e.

Constraints:

0 < t < 200

1 < n < 500

1 < m < n

0 < ni < nk < nj < 1000000

e corrected to 4 decimal places.

SAMPLE INPUT
2
4 2
0 10 20 30
5 3
2 7 13 19 27

SAMPLE OUTPUT
0.0000
0.2000

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: