#include <iostream>
#include <cstdio>#include <cmath>
using namespace std;
#define IP acos(-1.0)//太可恶了,错了n次,就是因为写成3.1415926,
//后来才发现至少要保留小数点后13位才AC!写此博客谨记教训!
int n, f;double a[10010], sum;
bool ok(double s)
{
int ans = 0;
for (int i = 0; i < n; i ++)
{
ans +=(int) (a[i] / s);
}
if (ans >= f)
return 1;
return 0;
}
int main()
{
int t;
double mid, l, r;
scanf("%d", & t);
while (t --)
{
scanf("%d %d", & n, & f);
f ++; sum = 0;
for (int i = 0; i < n; i ++)
{
scanf("%lf",&a[i]);
a[i] = IP * a[i] * a[i];
sum += a[i];
}
sum = sum / f;
l = 0, r = sum;
while (r - l > 0.000001)
{
mid = (l + r) / 2;
if (ok(mid))
l = mid;
else
r = mid;
}
printf("%.4f\n", l);
}
return 0;
}