#include <bits/stdc++.h>
using namespace std;
double TotalVolume(double x, const vector<int>& a) {
  double res = 0;
  for (int i = 0; i < a.size(); ++i) res += a[i] * x;
  return res;
}
bool Possible(int V, double x, const vector<int>& a, const vector<int>& b) {
  if (TotalVolume(x, a) > V) return false;
  for (int i = 0; i < b.size(); ++i) {
    if (a[i] * x > b[i]) {
      return false;
    }
  }
  return true;
}
int main() {
  int n, V;
  cin >> n >> V;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  double lo = 0, hi = V, cur = -1.0;
  int step = 0;
  while (lo < hi && step < 50) {
    cur = (lo + hi) / 2.0;
    if (Possible(V, cur, a, b)) {
      lo = cur;
    } else {
      hi = cur;
    }
    ++step;
  }
  cout << std::min(TotalVolume(cur, a), static_cast<double>(V)) << endl;
  return 0;
}
