#include <bits/stdc++.h>
using namespace std;
int n, V, A[64], B[64];
bool canCook(double x) {
  double tot = 0.0;
  for (int i = 0; i < n; i++)
    if (A[i] * x > B[i])
      return 0;
    else
      tot += A[i] * x;
  return tot <= V;
}
double totalAmount(double x) {
  double tot = 0.0;
  for (int i = 0; i < n; i++) tot += A[i] * x;
  return tot;
}
int main() {
  scanf("%d%d", &n, &V);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
  for (int i = 0; i < n; i++) scanf("%d", &B[i]);
  double lo = 0.0, hi = double(2 * V), mid;
  while (abs(hi - lo) >= 1e-6) {
    mid = (hi + lo) / 2;
    if (canCook(mid))
      lo = mid;
    else
      hi = mid;
  }
  printf("%.6f\n", totalAmount(lo));
}
