#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  double V;
  cin >> n >> V;
  int a[n], sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double x = V / sum, b;
  for (int i = 0; i < n; i++) {
    cin >> b;
    if (x * a[i] > b) x = b / a[i];
  }
  cout << sum * x << endl;
  return 0;
}
