#include <bits/stdc++.h>
using namespace std;
inline double min(double a, double b) { return a < b ? a : b; }
int main() {
  int n, i;
  double V, z, ans = 0;
  vector<double> a, b;
  scanf("%d%lf", &n, &V);
  for (i = 0; i < n; ++i) {
    scanf("%lf", &z);
    a.push_back(z);
  }
  for (i = 0; i < n; ++i) {
    scanf("%lf", &z);
    b.push_back(z);
  }
  double minx = 1e9;
  for (i = 0; i < n; ++i) minx = min(minx, b[i] / a[i]);
  for (i = 0; i < n; ++i) ans += (a[i] * minx);
  printf("%lf\n", min(ans, V));
  return 0;
}
