#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e4;
int a[maxN], b[maxN];
int n, sum, x, v;
bool check(double x) {
  for (int i = 1; i <= n; i++)
    if (a[i] * x > b[i]) return false;
  return true;
}
double binary(double l, double r) {
  double key = (l + r) / 2;
  if (r - l < 0.0000001) return key;
  if (check(key) && key * sum <= v)
    return binary(key, r);
  else
    return binary(l, key);
}
bool end() {
  for (int i = 1; i <= n; i++)
    if (b[i] == 0) return true;
  return false;
}
int main() {
  cin >> n >> v;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int i = 1; i <= n; i++) cin >> b[i];
  while (x * sum <= v && check(x)) x++;
  x--;
  for (int i = 1; i <= n; i++) b[i] -= a[i] * x;
  if (v - x * sum == 0 || end())
    cout << x * sum;
  else {
    v -= x * sum;
    double k = binary(0, 1);
    cout << setprecision(10) << (k + x) * sum;
  }
  return 0;
}
