#include <bits/stdc++.h>
using namespace std;
int main() {
  float a[100000];
  long long sum = 0, b[100000], c[100000], i, j, n, k, m;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> b[i];
    sum += b[i];
  }
  for (i = 0; i < n; i++) {
    cin >> c[i];
  }
  double mini = 9999999999;
  float rat;
  for (i = 0; i < n; i++) {
    rat = (float)c[i] / b[i];
    if (rat < mini) mini = rat;
  }
  if (sum * mini > k)
    cout << k << "\n";
  else
    printf("%0.16f\n", (float)sum * (float)mini);
}
