#include <bits/stdc++.h>
using namespace std;
int a[20];
int b[20];
int main() {
  int n, v, acum = 0;
  cin >> n >> v;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    acum += a[i];
  }
  for (int i = 0; i < n; i++) cin >> b[i];
  float minimo = 1000000;
  for (int i = 0; i < n; i++)
    if (((float)b[i] / (float)a[i]) < minimo)
      minimo = ((float)b[i] / (float)a[i]);
  cout << ((minimo * acum) < (v) ? (minimo * acum) : (v)) << endl;
}
