#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, V;
  cin >> n >> V;
  int a[20];
  double b[20];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int mini = 0;
  for (int i = 1; i < n; i++)
    if (b[mini] / a[mini] > b[i] / a[i]) mini = i;
  double minrate = b[mini] / a[mini];
  for (int i = 0; i < n; i++) b[i] = minrate;
  double answer = 0.0;
  for (int i = 0; i < n; i++) answer += a[i] * b[i];
  if (answer > V) answer = V;
  cout << answer;
  return 0;
}
