#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3ffffff;
const int N = 500020;
long long int n;
long long int V;
long long int a[N];
long long int b[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n >> V;
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  for (long long int i = 1; i <= n; i++) cin >> b[i];
  double minval = 1e9;
  for (long long int i = 1; i <= n; i++) {
    minval = min(minval, (double)((double)b[i] / (double)a[i]));
  }
  bool f = 1;
  double lo = 0.000000, hi = minval;
  while (lo + 0.000000001 < hi) {
    double mid = (lo + hi) / 2;
    double val = 0.0;
    for (long long int i = 1; i <= n; i++) val += (double)a[i] * mid;
    if (val > (double)V)
      hi = mid;
    else
      lo = mid;
  }
  double val = 0;
  for (long long int i = 1; i <= n; i++) val += (double)a[i] * hi;
  if (val <= (double)V) return cout << setprecision(10) << val << endl, 0;
  val = 0.0;
  for (long long int i = 1; i <= n; i++) val += (double)a[i] * lo;
  cout << setprecision(10) << val << endl;
  return 0;
}
