#include <bits/stdc++.h>
using namespace std;
long long const mod = 1073741824;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t, n, i, j, k = 0, cnt = 0, sum1 = 0, ccnt = 0, x, m, y, z, x1,
                        y1 = 0, z1, total = 0, sum = 0;
  double val = 0.0, c = 101.0;
  cin >> n >> m;
  long long a[n + 1];
  long long b[n + 1];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (i = 0; i < n; i++) {
    c = min((b[i] * 1.0) / (a[i] * 1.0), c);
  }
  for (i = 0; i < n; i++) {
    val += ((a[i] * 1.0) * c);
  }
  cout << setprecision(12) << min(val, (m * 1.0)) << endl;
  return 0;
}
