#include <bits/stdc++.h>
using namespace std;
int a[25], b[25];
double c[25];
double Min(double a, double b) { return a < b ? a : b; }
int main() {
  int n, mm, sum, i;
  double ans;
  while (scanf("%d%d", &n, &mm) != EOF) {
    sum = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      sum += a[i];
    }
    for (i = 0; i < n; i++) {
      scanf("%d", &b[i]);
      c[i] = (double)b[i] / a[i];
    }
    sort(c, c + n);
    ans = c[0] * sum;
    ans = Min(ans, mm);
    printf("%lf\n", ans);
  }
  return 0;
}
