/*
* @Description:
* @version:
* @Author:
* @Date: 2021-05-14 20:11:11
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-14 20:33:50
*/
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
bool cmp(pair<double, double> &a, pair<double, double> &b)
{
return a.second > b.second;
}
int main()
{
vector<pair<double, double>> mooncake;
int kind, sum;
cin >> kind >> sum;
for (int i = 0; i < kind; i++)
{
double kindsum;
cin >> kindsum;
mooncake.push_back(make_pair(kindsum, 0.));
}
for (int i = 0; i < kind; i++)
{
double sumMoney;
cin >> sumMoney;
mooncake[i].second = static_cast<double>(sumMoney) / mooncake[i].first;
}
sort(mooncake.begin(), mooncake.end(), cmp);
int index = 0;
double sumprofit = 0.;
while (true)
{
if (mooncake[index].first > sum)
break;
if (index == mooncake.size())
break;
else
{
sumprofit += mooncake[index].first * mooncake[index].second;
sum -= mooncake[index].first;
index++;
}
}
if (index <= mooncake.size() - 1)
sumprofit += static_cast<double>(sum) / mooncake[index].first * mooncake[index].first * mooncake[index].second;
// cout<<sumprofit<<endl;
printf("%.2f\n", sumprofit);
return 0;
}