#include <bits/stdc++.h>
using namespace std;
const double EPS = 1E-8;
const int INF = (int)1E+9;
int main() {
  int n, V;
  cin >> n >> V;
  int* a = new int[n];
  int* b = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  double res;
  double del = 1000000;
  int ndel, sum = 0;
  for (int i = 0; i < n; ++i) {
    if ((double)b[i] / (double)a[i] < del) {
      del = (double)b[i] / (double)a[i];
      ndel = i;
    }
    sum += a[i];
  }
  res = sum * del;
  if (res < V) {
    cout << res;
    return 0;
  }
  cout << V;
  return 0;
}
