#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, v;
  cin >> n >> v;
  int a[n], b[n];
  float c[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) {
    c[i] = b[i] / (a[i] * 1.0);
  }
  float minn = *min_element(c, c + n);
  float sum = 0.00;
  for (int i = 0; i < n; i++) {
    sum += minn * a[i];
  }
  if (sum > v)
    cout << v << endl;
  else
    cout << sum << endl;
}
