#include <bits/stdc++.h>
using namespace std;
int a[500], b[500];
int main() {
  int n, v;
  int sum = 0;
  scanf("%d %d", &n, &v);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]), sum += a[i];
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  double x = 1e10;
  for (int i = 0; i < n; i++) x = min(x, b[i] / (double)a[i]);
  printf("%.6lf\n", min((double)v, x * sum));
  return 0;
}
