#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const double inf = 1e-7;
struct node {
int zl;
int jz;
double dj;
}zz[100];
bool cmp(const node &a,const node &b)
{
return a.dj > b.dj;
}
int main()
{
int t;
int n, m;
cin >> t;
while (t--)
{
double ans = 0;
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
cin >> zz[i].zl;
}
for (int i = 1; i <= n; i++)
{
cin >> zz[i].jz;
}
for (int i = 1; i <= n; i++)
{
zz[i].dj = 1.0*zz[i].jz / zz[i].zl;
}
sort(zz + 1, zz + n + 1, cmp);
for (int i = 1; i <= n; i++)
{
if (zz[i].zl <= m)
{
m = m - zz[i].zl;
ans = ans + zz[i].jz;
}
else
{
ans = ans + 1.0*m*zz[i].dj;
break;
}
}
printf("%.2f\n", ans + inf);
}
return 0;
}