#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, v, i;
  cin >> n >> v;
  vector<int> a(n), b(n);
  vector<double> c(n);
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < n; i++) c[i] = (b[i] * 1.0 / a[i]);
  sort(c.begin(), c.end());
  double total = 0.0;
  for (i = 0; i < n; i++) total += c[0] * a[i];
  double ans = (min(total, v * 1.0));
  cout << ans / 1.0;
  return 0;
}
