#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
struct ss {
double sale,price,num;;
};
bool cmp(struct ss a,struct ss b) {
return a.sale>b.sale;
}
int main () {//贪心策略
int n,m;
cin>>n>>m;
struct ss s[n];
for(int i=0; i<n; ++i)
cin>>s[i].num;
for(int i=0; i<n; ++i) {
cin>>s[i].price;
s[i].sale=1.*s[i].price/s[i].num;
}
sort(s,s+n,cmp);
double ans=0;
for(auto i : s) {
if(m-i.num>0) {
m-=i.num;
ans+=i.price;
} else {
ans+=i.sale*m;
break;
}
}
printf("%.2lf",ans);
return 0;
}