#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
struct data {
  data() {}
  bool friend operator<(data a, data b) { return 0; }
};
int n, m, k;
long long N, M, K;
double a[22];
double b[22];
double temp;
int sol(double x) {
  temp = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] * x > b[i]) return 0;
    temp += a[i] * x;
  }
  if (temp > m * 1.0) return 0;
  return 1;
}
int main() {
  int t, tc = 1;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &b[i]);
  }
  double ans = 0;
  double l = 0, h = m * 1.0;
  for (int i = 1; i <= 100; i++) {
    double mid = (l + h) / 2;
    if (sol(mid)) {
      ans = temp;
      l = mid;
    } else {
      h = mid;
    }
  }
  printf("%.8lf\n", ans);
  return 0;
}
