#include <bits/stdc++.h>
using namespace std;
int a[1000], b[1000], i, j, n, k, l, s;
int p[25];
double x, v, m = 1e9;
int main() {
  cin >> n >> v;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
    s += a[i];
  }
  for (i = 0; i < n; ++i) {
    cin >> b[i];
    m = min(m, b[i] * 1. / a[i]);
  }
  x = v / s;
  cout.precision(10);
  cout << min(m + 0., x) * s;
  return 0;
}
