#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, v;
  cin >> n >> v;
  double a[n], mn = INT_MAX, b[n], sum = 0.0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    mn = min(mn, b[i] / a[i]);
  }
  for (int i = 0; i < n; i++) {
    sum += (a[i] * mn);
  }
  sum = min(sum, (double)v);
  printf("%.4lf", sum);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  { solve(); }
  return 0;
}
