#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
struct node{
double quantity;
double price;
double perprice;
};
bool cmp(struct node a, struct node b){
return a.perprice > b.perprice;
}
int main() {
int kind;
double need;
cin >> kind >> need;
vector<node> mooncake(kind);
for (int i = 0; i < kind; i++) {
cin >> mooncake[i].quantity;
}
for (int i = 0; i < kind; i++) {
cin >> mooncake[i].price;
mooncake[i].perprice = mooncake[i].price / mooncake[i].quantity;
}
sort(mooncake.begin(), mooncake.end(), cmp);
double Price = 0;
for (int i = 0; i < kind; i++) {
if (need > mooncake[i].quantity) {
need -= mooncake[i].quantity;
Price += mooncake[i].price;
}else{
Price += mooncake[i].price * need / mooncake[i].quantity;
break;
}
}
printf("%.2lf\n", Price);
return 0;
}