#include <bits/stdc++.h>
using namespace std;
const int maxN = 10000 + 10;
int a[maxN], b[maxN];
int main() {
  int n, m, f, sum = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  double mine = (double)b[0] / (double)a[0];
  for (int i = 1; i < n; i++) mine = min((double)b[i] / (double)a[i], mine);
  cout << fixed << setprecision(4) << min(mine * sum, double(m));
  return 0;
}
