#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, v;
  cin >> n >> v;
  vector<double> a(n + 3), b(n + 3);
  double sum = 0;
  for (int i = 1; i <= n; ++i) cin >> a[i], sum += a[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  double x = 1.0 * v / sum;
  for (int i = 1; i <= n; ++i) x = min(x, b[i] / a[i]);
  cout << fixed << setprecision(10) << x * sum;
  return 0;
}
