#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  double v;
  cin >> n >> v;
  double a[n], b[n], sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
  }
  double l = 0, r = v, ans;
  while (r - l > 0.0001) {
    double mid = (l + r) / 2;
    double x = mid / sum;
    bool flag = true;
    for (long long i = 0; i < n; i++) {
      if (a[i] * x > b[i]) {
        flag = false;
      }
    }
    if (flag) {
      ans = mid;
      l = mid;
    } else {
      r = mid;
    }
  }
  cout << fixed << setprecision(6) << ans;
}
