#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, V;
  cin >> n >> V;
  int a[n], b[n];
  double x = 1000;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    x = (x < ((b[i] * 1.0) / a[i]) ? x : ((b[i] * 1.0) / a[i]));
  }
  double v = 0;
  for (int i = 0; i < n; i++) v += a[i] * x;
  cout << (v < V ? v : V);
  return 0;
}
