#include <bits/stdc++.h>
using namespace std;
int main() {
  long long j, w, i, c, d, e, k;
  string z, y;
  double h[21], p[21], o[21], l = 1000, s = 0, a, b;
  cin >> a >> b;
  for (i = 1; i <= a; i++) {
    cin >> p[i];
  }
  for (i = 1; i <= a; i++) {
    cin >> o[i];
  }
  for (i = 1; i <= a; i++) {
    h[i] = o[i] / p[i];
    l = min(l, h[i]);
  }
  for (i = 1; i <= a; i++) {
    s = s + (l * p[i]);
  }
  printf("%.6f", min(s, b));
}
