#include <bits/stdc++.h>
using namespace std;
int n;
double v, x = 1e9, ans = 0;
vector<double> a, b;
int main(int argc, char *argv[]) {
  scanf("%d%lf", &n, &v);
  a.resize(n);
  b.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%lf", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%lf", &b[i]);
    x = min(x, b[i] / a[i]);
  }
  for (int i = 0; i < n; ++i) {
    ans += a[i] * x;
  }
  printf("%.8lf", min(ans, v));
  return 0;
}
