#include <bits/stdc++.h>
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  char ch;
  ch = getchar();
  int array[a];
  int vol[a];
  float final = 0;
  float temp;
  int j, k;
  float u, r;
  int check;
  float min;
  float st, su, lm, lr;
  for (int i = 0; i < a; i++) {
    scanf("%d", &array[i]);
  }
  for (j = 0; j < a; j++) {
    scanf("%d", &vol[j]);
  }
  lm = vol[0];
  lr = array[0];
  min = lm / lr;
  for (j = 1; j < a; j++) {
    st = vol[j];
    su = array[j];
    if (min > (st / su)) {
      min = st / su;
    }
  }
  for (j = 0; j < a; j++) {
    r = array[j];
    final = final + (float)(min * r);
  }
  u = b;
  if (final <= u) {
    printf("%f\n", final);
  } else {
    printf("%f\n", u);
  }
  return 0;
}
