#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  std::cout.unsetf(std::ios::floatfield);
  std::cout.precision(50);
  long long a, b, c, d, x, i, j, n, t, m, k, y;
  double p, s, q, r, w;
  string str = "", str1 = "";
  long long a1, a2, b1, b2;
  cin >> n >> d;
  vector<long long> v1, v2;
  c = 0;
  for (i = 0; i < n; i = i + 1) {
    cin >> a;
    c += a;
    v1.push_back(a);
  }
  for (i = 0; i < n; i = i + 1) {
    cin >> b;
    v2.push_back(b);
  }
  p = DBL_MAX;
  for (i = 0; i < n; i = i + 1) {
    p = min(p, (double)v2[i] / v1[i]);
  }
  p = min(p, (double)d / c);
  p = p * c;
  cout << p;
}
