#include <bits/stdc++.h>
using namespace std;
int n, V;
int a[25];
int D[25];
int check(double res) {
  int i;
  double r = 0.0;
  for (i = 0; i < n; i++) {
    if (a[i] * res > D[i]) return 0;
    r = r + a[i] * res;
  }
  if (r + 1e-7 <= V)
    return 1;
  else
    return 0;
}
double cal() {
  int i;
  double l, h, mid;
  l = 0;
  h = V;
  for (i = 0; i < 100; i++) {
    mid = (l + h) / 2;
    if (check(mid)) {
      l = mid;
    } else {
      h = mid;
    }
  }
  return l;
}
int main() {
  int i, j;
  double res, r;
  while (scanf("%d %d", &n, &V) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    for (i = 0; i < n; i++) {
      scanf("%d", &D[i]);
    }
    r = cal();
    res = 0.0;
    for (i = 0; i < n; i++) {
      res = res + a[i] * r;
    }
    printf("%lf\n", res);
  }
  return 0;
}
