#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
struct MoonCake{
double ton;//只说是正数 没说是正整数
double price;
double one;
}mc[1010];
bool cmp(MoonCake a,MoonCake b){
return a.one>b.one;
}
int main(){
int n;
double d;
scanf("%d%lf",&n,&d);
for(int i=0;i<n;i++){
scanf("%lf",&mc[i].ton);
}
for(int i=0;i<n;i++){
scanf("%lf",&mc[i].price);
}
for(int i=0;i<n;i++){
mc[i].one=mc[i].price/mc[i].ton;
}
sort(mc,mc+n,cmp);
double count=0;
// int i=0;
// while(d>0)//浮点数的精度问题?
for(int i=0;i<n;i++){
if(d>=mc[i].ton){
d-=mc[i].ton;
count+=mc[i].price;
}else{
count+=mc[i].one*d;
break;
// d=0;
}
// i++;
}
printf("%.2f",count);
}```