#include<iostream>
#include <iomanip>
#include <cstdio>
#include<string>
#include<vector>
#include<array>
#include<math.h>
#include<algorithm>
using namespace std;
struct s
{
double a, b, c;
}stu[1000];
bool cmp(s x,s y)
{
return x.c > y.c;
}
int main()
{
double m;
int n,i;
cin >> n>>m;
for (i = 0; i < n; i++)
cin >> stu[i].a;
for (i = 0; i < n; i++)
cin >> stu[i].b;
for (i = 0; i < n; i++)
stu[i].c = stu[i].b / stu[i].a;
sort(stu, stu + n, cmp);
double money = 0;
for (i = 0; i < n; i++)
{
if (m <= stu[i].a)
{
money += m * stu[i].c;
break;
}
else
{
money += stu[i].a * stu[i].c;
m = m - stu[i].a;
}
}
printf("%0.2f", money);
return 0;
}