#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, vv;
  cin >> n >> vv;
  long long a[n], b[n];
  double sum = 0.0, mn = 100000000.0, v = 1.0 * vv;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += 1.0 * a[i];
  }
  for (int i = 0; i < n; i++) cin >> b[i];
  double r;
  for (int i = 0; i < n; i++) {
    r = 1.0 * b[i] / a[i];
    mn = min(mn, r);
  }
  mn = min(mn, v / sum);
  double res = 0.0;
  for (int i = 0; i < n; i++) res += 1.0 * mn * a[i];
  cout << res;
  return 0;
}
