#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, V, ratios[105], available[105];
  cin >> n >> V;
  for (int i = 0; i < n; i++) cin >> ratios[i];
  for (int i = 0; i < n; i++) cin >> available[i];
  int mini = -1;
  double minprod = 1e9;
  for (int i = 0; i < n; i++) {
    if (1.0 * available[i] / ratios[i] < minprod) {
      minprod = 1.0 * available[i] / ratios[i];
      mini = i;
    }
  }
  double sum = accumulate(ratios, ratios + n, 0.0);
  double soup = min((double)V, 1.0 * available[mini] / ratios[mini] * sum);
  cout << soup << endl;
  return 0;
}
