#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int v;
  cin >> v;
  double a[n + 1];
  double b[n + 1];
  double m = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    m += a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  double x = 100000000;
  for (int i = 1; i <= n; i++) {
    x = min(x, b[i] / a[i]);
  }
  if (v < x * m) {
    cout << v;
  } else {
    cout << x * m;
  }
}
