# include<cstdio>
# include<vector>
# include<algorithm>
using namespace std;
class Mooncake{
private:
double singlePrice = -1.0;
double store = -1.0;
double totalPrice = -1.0;
public:
Mooncake(double store, double totalPrice){
this->store = store;
this->totalPrice = totalPrice;
this->singlePrice = totalPrice / store;
}
double getSinglePrice(){
return this->singlePrice;
}
double getStore(){
return this->store;
}
double getTotalPrice(){
return this -> totalPrice;
}
double sell(double sellStore){
if(this->store > 0 && this->store >= sellStore){
this->store -= sellStore;
this->totalPrice -= this->singlePrice * sellStore;
return this->singlePrice * sellStore;
}
else{
this->store = -1.0;
return totalPrice;
}
}
};
bool cmp(Mooncake a, Mooncake b){
return a.getSinglePrice() > b.getSinglePrice();
}
double tmp[1010] = {0};
int main(){
vector<Mooncake> totalCake;
int N = 0;
double D = 0;
scanf("%d %lf", &N, &D);
for(int i = 0 ; i < N; i++){
scanf("%lf", &tmp[i]);
}
for(int i = 0; i < N; i++){
double totalPrice;
scanf("%lf", &totalPrice);
Mooncake mk = Mooncake(tmp[i], totalPrice);
totalCake.push_back(mk);
}
sort(totalCake.begin(), totalCake.end(), cmp);
double total = 0.000;
for(int i = 0; i < totalCake.size(); i++){
Mooncake currentCake = totalCake[i];
if(currentCake.getStore() <= D){
D -= currentCake.getStore();
total += currentCake.getTotalPrice();
}
else{
total += currentCake.sell(D);
break;
}
}
printf("%.2f",total);
return 0;
}