<?php
    $in = fopen("input.txt", 'r');
    $out = fopen("output.txt", 'w');

    while (!feof($in)) {
        $get[] = fgets($in);
    }

    $get = explode("\n", implode("", $get));
    $n = $get[0];
    $signals = ltrim(rtrim($get[1], "0\n"), "0");

    $interval = -1;
    $zeros = 0;

    for($i=1;$i<strlen($signals);++$i){
        echo $signals[$i] . " ";
        echo $zeros . "\n";
        if($signals[$i]=="0") $zeros++;

        else if($signals[$i]=="1"){
            if($interval==-1){
                $interval = $zeros;
                $zeros=0;
            }
            else if($zeros!=$interval){
                fputs($out, "NO");
                return;
            }
            else $zeros = 0;
        }
    }

    fputs($out, "YES");
?>


<?php
    $in = fopen("input.txt", 'r');
    $out = fopen("output.txt", 'w');

    $i=0;
    while (!feof($in)) {
        $get[++$i] = fgets($in);
    }

    $get = explode("\n", implode("", $get));

    $n = $get[0];
    $signals = rtrim(" \r\n", $get[1]);

    $interval = -1;
    $zeros = 0;
    $count_now=false;
    for($i=0;$i<$n;++$i){
        if($signals[$i]=="0")$zeros++;
        else if($signals[$i]=="1"){
            if($count_now==false){
               $count_now=true;
               $zeros=0;
            }
            else{
                if($interval==-1){
                    $interval = $zeros;
                    $zeros=0;
                }
                else if($zeros!=$interval){
                    fputs($out, "NO");
                    return;
                }
            }
        }
    }

    fputs($out, "YES");
?>


inp = open('input.txt', 'r')
out = open('output.txt', 'w')
n=int(inp.readline())
a=inp.readline()
ans=[]
for i in range(len(a)):
    if a[i]=='1': ans.append(i)
flag=0
d=ans[1]-ans[0]
for i in range(len(ans)-1):
    if ans[i+1]-ans[i]!=d:
        flag=1
out.write('YES' if flag==0 else 'NO')


import sys
input = lambda: sys.stdin.readline().rstrip()
def I(): return [int(iI) for iI in input().split()]
def II() : return int(input())
def SI(): return [iI for iI in input()]
from collections import Counter
n=II()
a=SI()
ans=[]
for i in range(len(a)):
    if a[i]=='1': ans.append(i)
flag=0
d=ans[1]-ans[0]
for i in range(len(ans)-1):
    if ans[i+1]-ans[i]!=d:
        flag=1
print('YES' if flag==0 else 'NO')


import sys
input = lambda: sys.stdin.readline().rstrip()
def I(): return [int(iI) for iI in input().split()]
def II() : return int(input())
def SI(): return [iI for iI in input()]
from collections import Counter
input_file = open('input.txt', 'r')
output_file = open('output.txt', 'w')
n=II()
a=SI()
ans=[]
for i in range(len(a)):
    if a[i]=='1': ans.append(i)
flag=0
d=ans[1]-ans[0]
for i in range(len(ans)-1):
    if ans[i+1]-ans[i]!=d:
        flag=1
print('YES' if flag==0 else 'NO')


fin = open('input.txt')
fout = open('output.txt', 'w')
n = int(fin.readline())
s = str(fin.readline())
a = set()
p = 0
d = 0
first_met = False
for i in range(n):
    if s[i] == '1':
        if not first_met:
            first_met = True
        else:
            a.add(i - d)
        d = i
if len(a) == 1:
    print("YES", file=fout)
else:
    print("NO", file=fout)
fin.close()
fout.close()


fin = open('input.txt')
fout = open('output.txt')
n = int(fin.readline())
s = str(fin.readline())
a = set()
p = 0
d = 0
first_met = False
for i in range(n):
    if s[i] == '1':
        if not first_met:
            first_met = True
        else:
            a.add(i - d)
        d = i
if len(a) == 1:
    print("YES", file=fout)
else:
    print("NO", file=fout)
fin.close()
fout.close()


import sys
import math
import bisect

def solve(s):
    n = len(s)
    A = []
    for i in range(n):
        if s[i] == '1':
            A.append(i)
    delta = -1
    for i in range(1, len(A)):
        if i == 1:
            delta = A[i] - A[i-1]
        else:
            if A[i] - A[i-1] != delta:
                return False
    return True

def main():
    input_file = open('input.txt', 'r')
    output_file = open('output.txt', 'w')
    n = int(input_file.readline()[:-1])
    s = input_file.readline()[:-1]
    if solve(s):
        output_file.write('YES\n')
    else:
        ouput_file.write('NO\n')

if __name__ == "__main__":
    main()


import sys
import math
import bisect

def solve(s):
    n = len(s)
    A = []
    for i in range(n):
        if s[i] == '1':
            A.append(i)
    for i in range(1, len(A)):
        if i == 1:
            delta = A[i] - A[i-1]
        else:
            if A[i] - A[i-1] != delta:
                return False
    return True

def main():
    n = int(input())
    s = input()
    if solve(s):
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()


import sys
import math
import bisect

def solve(s):
    n = len(s)
    A = []
    for i in range(n):
        if s[i] == '1':
            A.append(i)
    delta = -1
    for i in range(1, len(A)):
        if i == 1:
            delta = A[i] - A[i-1]
        else:
            if A[i] - A[i-1] != delta:
                return False
    return True

def main():
    input_file = open('input.txt', 'r')
    output_file = open('output.txt', 'w')
    n = int(input_file.readline()[:-1])
    s = input_file.readline()[:-1]
    if solve(s):
        output_file.write('YES\n')
    else:
        output_file.write('NO\n')

if __name__ == "__main__":
    main()


inp=open("input.txt","r")
oup=open("input.txt","w")
n=int(inp.readline())
s=inp.readline()
index=[]
for i in range(0,n):
    if s[i]=='1':
        index.append(i)
ans=True
if len(index)==1:
    print("YES")
else:
    diff=index[1]-index[0]
    flag=0
    for i in range(1,len(index)):
        if index[i]-index[i-1]!=diff:
            flag=1
            break
    if flag==0:
        print("YES")
    else:
        print("NO")


inp=open("input.txt",'r')
oup=open("output.txt",'w')
n=int(inp.readline())
s=inp.readline()
index=[]
for i in range(0,n):
    if s[i]=='1':
        index.append(i)
if len(index)==1:
    oup.print("YES")
else:
    diff=index[1]-index[0]
    flag=0
    for i in range(1,len(index)):
        if index[i]-index[i-1]!=diff:
            flag=1
            break
    if flag==0:
        oup.print("YES")
    else:
        oup.print("NO")


inp=open("input.txt",'r')
oup=open("output.txt",'w')
n=int(inp.readline())
s=inp.readline()
index=[]
for i in range(0,n):
    if s[i]=='1':
        index.append(i)
ans=True
if len(index)==1:
    print("YES")
else:
    diff=index[1]-index[0]
    flag=0
    for i in range(1,len(index)):
        if index[i]-index[i-1]!=diff:
            flag=1
            break
    if flag==0:
        print("YES")
    else:
        print("NO")


inp=open("input.txt",'r')
oup=open("output.txt",'w')
n=int(inp.readline())
s=inp.readline()
index=[]
for i in range(0,n):
    if s[i]=='1':
        index.append(i)

if len(index)==1:
    oup.write("YES")
else:
    diff=index[1]-index[0]
    flag=0
    for i in range(1,len(index)):
        if index[i]-index[i-1]!=diff:
            flag=1
            break
    if flag==0:
        oup.write("YES")
    else:
        oup.write("NO")


import sys

f = open("input.txt")
o = open("output.txt", "w")

n_bits = int(f.readline())
bits = [x for x in f.readline().strip()]

first, last = -1, -1
for index, i in enumerate(bits):
    if i == "1":
        if first == -1:
            first = index
        last = index

substr = bits[first:last+1]
print(substr)
if substr == substr[::-1]:
    o.write("YES")
else:
    o.write("NO")


n = int(input())
s = input()
t = []
for i in range(n):
    if s[i] == '1':
        t.append(i)
d = t[1] - t[0]
f = False
for i in range(1, len(t) - 1):
    if t[i+1] - t[i] != d:
        f = True
        break
if f:
    print('NO')
else:
    print('YES')


n = int(input())
s = input()
r = []
for i in range(n):
    if s[i] == '1':
        r.append(i)
if r == []:
    print('NO')
elif len(r) == 1:
    print('YES')
else:
    f = True
    d = r[1] - r[0]
    for i in range(1, len(r)-1):
        if r[i+1] - r[i] != d:
            f = False
            break
    print('YES' if f else 'NO')


x = int(input())
s = input()
t = []
for i in range(x):
    if s[i] == '1':
        t.append(i)
d = t[1] - t[0]
f = False
for i in range(1, len(t) - 1):
    if t[i+1] - t[i] != d:
        f = True
        break
if f:
    print('NO')
else:
    print('YES')


import sys
sys.stdin=open('input.txt','r')
sys.stdout=open('output.txt','w')

n=int(input())
s=input()
ip=0
fp=n
z=0
zz=0
for i in range(n):
	if s[i]=="1" and z==0:
		ip=i
		z=1
	if s[n-1-i]=="1" and zz==0:
		fp=n-1-i
		zz=1
	if z==1 and zz==1:
		break
s=s[ip:fp+1]
#print(s)
count0,count00,count1,count11,check,z1,z0=[0]*7
for x in s:
	if x=="1":
#		print(count00,count0,count11,count1,"a")
		if count00!=0 and z1==1:
			if count0!=count00:
				check=1
				break
		else:
			count00=count0
		count0=0
		count1+=1
		z0=1
		z1=0
	else:
#		print(count00,count0,count11,count1,"b")
		if count11!=0 and z0==1:
			if count1!=count11:
				check=1
				break
		else:
			count11=count1
		count1=0
		z0=0
		z1=1
		count0+=1
if count11!=0:
	if count1!=count11:
		check=1
if check==0:
	print("YES")
else:
	print("NO")


import sys
sys.stdin=open('input.txt','r')
sys.stdout=open('output.txt','w')

n=int(input())
s=input()
ip=0
fp=n
z=0
zz=0
for i in range(n):
	if s[i]=="1" and z==0:
		ip=i
		z=1
	if s[n-1-i]=="1" and zz==0:
		fp=n-1-i
		zz=1
	if z==1 and zz==1:
		break
s=s[ip:fp+1]
#print(s)
count0,count00,count1,count11,check=[0]*5
for x in s:
	if x=="1":
		if count00!=0:
			if count0!=count00:
				check=1
				break
		else:
			count00=count0
		count0=0
		count1+=1
	else:
		if count11!=0:
			if count1!=count11:
				check=1
				break
		else:
			count11=count1
		count1=0
		count0+=1
if check==0:
	print("YES")
else:
	print("NO")


stdin=open('input.txt','r')
stdout=open('output.txt','w')

n=int(input())
s=input()
ip=0
fp=n
z=0
zz=0
for i in range(n):
	if s[i]=="1" and z==0:
		ip=i
		z=1
	if s[n-1-i]=="1" and zz==0:
		fp=n-1-i
		zz=1
	if z==1 and zz==1:
		break
s=s[ip:fp+1]
#print(s)
count0,count00,count1,count11,check=[0]*5
for x in s:
	if x=="1":
		if count00!=0:
			if count0!=count00:
				check=1
				break
		else:
			count00=count0
		count0=0
		count1+=1
	else:
		if count11!=0:
			if count1!=count11:
				check=1
				break
		else:
			count11=count1
		count1=0
		count0+=1
if check==0:
	print("YES")
else:
	print("NO")


import sys
sys.stdin=open('input.txt','r')
sys.stdout=open('output.txt','w')

n=int(input())
s=input()
ip=0
fp=n
z=0
zz=0
for i in range(n):
	if s[i]=="1" and z==0:
		ip=i
		z=1
	if s[n-1-i]=="1" and zz==0:
		fp=n-1-i
		zz=1
	if z==1 and zz==1:
		break
s=s[ip:fp+1]
#print(s)
count0,count00,count1,count11,check,z1,z0=[0]*7
for x in s:
	if x=="1":
#		print(count00,count0,count11,count1,"a")
		if count00!=0 and z1==1:
			if count0!=count00:
				check=1
				break
		else:
			if count00==0:
				count00=count0
		count0=0
		count1+=1
		z0=1
		z1=0
	else:
#		print(count00,count0,count11,count1,"b")
		if count11!=0 and z0==1:
			if count1!=count11:
				check=1
				break
		else:
			if count11==0:
				count11=count1
		count1=0
		z0=0
		z1=1
		count0+=1
if count11!=0:
	if count1!=count11:
		check=1
if check==0:
	print("YES")
else:
	print("NO")


import sys
sys.stdin = open("input.txt","r")
sys.stdout = open("output.txt","w+")
a=int(input());z=[]
for i,j in enumerate(input()):
    if j=='1':z.append(i)
f=[]
for i in range(1,len(z)):z.append(z[i]-z[i-1])
if len(f)<=1:print("YES")
else:print("NO")


import sys
sys.stdin = open("input.txt","r")
sys.stdout = open("output.txt","w+")
a=int(input());z=[]
for i,j in enumerate(input()):
    if j=='1':z.append(i)
f=[]
for i in range(1,len(z)):f.append(z[i]-z[i-1])
if len(set(f))<=1:print("YES")
else:print("NO")


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; float v,a[100],b[100],x,k,sa=0,minb=1e9; cin >> n >> v;
    for (int i=0; i<n; i++) {
        cin >> a[i]; sa+=a[i];
    }
    for (int i=0; i<n; i++) {
        cin >> b[i];
        if (b[i]/a[i]<minb) minb=b[i]/a[i];
    }
    k=min(v/sa,minb);
    float s=0;
    for (int i=0; i<n; i++) s+=k*a[i];
    cout << setprecision(5) << fixed << s << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,gb; float v,a[100],b[100],x,k,sa=0,minb=1e9; cin >> n >> v;
    for (int i=0; i<n; i++) {
        cin >> a[i];
        sa+=a[i];
    }
    for (int i=0; i<n; i++) {
        cin >> b[i];
        if (b[i]<minb) { minb=b[i]; gb=i; }
    }
    k=min(v/sa,minb/a[gb]);
    cout << setprecision(5) << fixed << k << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,gb; float v,a[100],b[100],x,k,sa=0,minb=1e9; cin >> n >> v;
    for (int i=0; i<n; i++) {
        cin >> a[i];
        sa+=a[i];
    }
    for (int i=0; i<n; i++) {
        cin >> b[i];
        if (b[i]<minb) { minb=b[i]; gb=i; }
    }
    k=min(v/sa,minb/a[gb]);
    float s=0;
    for (int i=0; i<n; i++) s=s+k*a[i];
    cout << setprecision(5) << fixed << s << endl;
    return 0;
}


#include<stdio.h>
#include<iostream>
using namespace std;
main()
{
      double n,v,c=132131,sum=0,t;
      scanf("%lf %lf",&n,&v);
      double a[100000],b[10000];
      for(int i=1;i<=n;i++)
      {
              scanf("%lf",&a[i]);
      }
      for(int i=1;i<=n;i++)
      {
              scanf("%lf",&b[i]);
      }
      for(int i=1;i<=n;i++)
      {
              if(b[i]<c)
              {
                        c=b[i];
              }
      }
      t=c;
      for(int i=1;i<=n;i++)
      {
              c*=a[i];
              sum+=c;
              c=t;
      }
      if(sum>v)
      {
               printf("%lf",v);
               getchar();
               getchar();
               return 0;
      }
      printf("%lf",sum);
      getchar();
      getchar();
      return 0;
}


#include<stdio.h>
main()
{
    int n;
    double v,a[25],b[25],m=200.0,s=0.0;
    scanf("%d%lf",&n,&v);
    for(int i=0;i<n;i++)
    {
        scanf("%lf",&a[i]);
        s+=a[i];
    }
    for(int i=0;i<n;i++) scanf("%lf",&b[i]);
    for(int i=0;i<n;i++)
    {
        if(b[i]/a[i]<m) m=b[i]/a[i];
    }
    m=m*double(s);
    if(m>v) printf("%.4lf",v);
    else printf("%.4lf",m);
    return 0;
}


#include<stdio.h>
main()
{
    int n;
    double v,a[25],b[25],m=200.0;
    scanf("%d%lf",&n,&v);
    for(int i=0;i<n;i++) scanf("%lf",&a[i]);
    for(int i=0;i<n;i++) scanf("%lf",&b[i]);
    for(int i=0;i<n;i++)
    {
        if(b[i]/a[i]<m) m=b[i]/a[i];
    }
    m=m*double(n);
    if(m>v) printf("%.4lf",v);
    else printf("%.4lf",m);
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define eps 1e-9
double min(double a,double b)
{
    if(a-b<eps)     return a;
    else            return b;
}
int main()
{
    int n,a[30],b[30],i,j;
    double sum,c[30],k,v;
    while(scanf("%d%lf",&n,&v)!=EOF)
    {
        for(i=1,sum=0;i<=n;i++)
        {
            scanf("%d",a+i);
            sum+=a[i];
        }
        for(i=1;i<=n;i++)
        {
            scanf("%d",b+i);
            c[i]=b[i]*1.0/a[i];
        }
        k=v*1.0/sum;
        for(i=1;i<=n;i++)
        {
            k=min(k,c[i]);

        }
        printf("%.1f\n",k*sum);
    }
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
int main()
{
    int n,v,a[30],b[30],i,j;
    double ans,sum,c[30],k;
    while(scanf("%d%d",&n,&v)!=EOF)
    {
        for(i=1,sum=0;i<=n;i++)
        {
            scanf("%d",a+i);
            sum+=a[i];
        }
        for(i=1,ans=0;i<=n;i++)
        {
            scanf("%d",b+i);
            ans+=b[i];
            c[i]=b[i]*1.0/a[i];
        }
        k=v/sum;
        for(i=1;i<=n;i++)
        {
            k=min(k,c[i]);

        }
        printf("%.1f\n",k*sum);
    }
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define eps 1e-9
double min(double a,double b)
{
    if(a-b<eps)     return a;
    else            return b;
}
int main()
{
    int n,a[30],b[30],i,j;
    double sum,c[30],k,v;
    while(scanf("%d%lf",&n,&v)!=EOF)
    {
        for(i=1,sum=0;i<=n;i++)
        {
            scanf("%d",a+i);
            sum+=a[i];
        }
        for(i=1;i<=n;i++)
        {
            scanf("%d",b+i);
            c[i]=b[i]*1.0/a[i];
        }
        k=v*1.0/sum;
        for(i=1;i<=n;i++)
        {
            k=min(k,c[i]);

        }
        printf("%f\n",k*sum);
    }
}


#pragma comment(linker, "/STACK:16777216")

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

using namespace std;

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }

typedef long long ll;

#define eps 1e-10
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3fLL

#define fr(x,y,z) for(int(x)=(y);(x)<(z);(x)++)
#define cast(x,t) *({stringstream ss;static t __ret;ss<<x,ss>>__ret;&__ret;})

#define dbg(x) cout << #x << " == " << x << endl
#define print(x) cout << x << endl

// var
int N;
double V;
double A[22], B[22];

int main() {

	// solve
	scanf("%d %lf",&N,&V);
	fr(i,0,N) scanf("%lf",A+i);
	fr(i,0,N) scanf("%lf",B+i);

	double tot = 0;
	fr(i,0,N) tot += A[i] * B[i];

	printf("%lf\n",min(V,tot));

	return 0;
}


#pragma comment(linker, "/STACK:16777216")

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

using namespace std;

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }

typedef long long ll;

#define eps 1e-10
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3fLL

#define fr(x,y,z) for(int(x)=(y);(x)<(z);(x)++)
#define cast(x,t) *({stringstream ss;static t __ret;ss<<x,ss>>__ret;&__ret;})

#define dbg(x) cout << #x << " == " << x << endl
#define print(x) cout << x << endl

// var
int N;
double V;
double A[22], B[22];

int main() {

	// solve
	scanf("%d %lf",&N,&V);
	fr(i,0,N) scanf("%lf",A+i);
	fr(i,0,N) scanf("%lf",B+i);

	double tot = 1e100, sA = 0;
	fr(i,0,N) tot = min(B[i],tot), sA += A[i]; tot *= sA;

	printf("%lf\n",min(V,tot));

	return 0;
}


#pragma comment(linker, "/STACK:16777216")

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

using namespace std;

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }

typedef long long ll;

#define eps 1e-10
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3fLL

#define fr(x,y,z) for(int(x)=(y);(x)<(z);(x)++)
#define cast(x,t) *({stringstream ss;static t __ret;ss<<x,ss>>__ret;&__ret;})

#define dbg(x) cout << #x << " == " << x << endl
#define print(x) cout << x << endl

// var
int N;
double V;
double A[22], B[22];

int main() {

	// solve
	scanf("%d %lf",&N,&V);
	fr(i,0,N) scanf("%lf",A+i);
	fr(i,0,N) scanf("%lf",B+i);

	double tot = 1e100;
	fr(i,0,N) tot = min(A[i] * B[i],tot); tot *= N;

	printf("%lf\n",min(V,tot));

	return 0;
}


#pragma comment(linker, "/STACK:16777216")

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

using namespace std;

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }

typedef long long ll;

#define eps 1e-10
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3fLL

#define fr(x,y,z) for(int(x)=(y);(x)<(z);(x)++)
#define cast(x,t) *({stringstream ss;static t __ret;ss<<x,ss>>__ret;&__ret;})

#define dbg(x) cout << #x << " == " << x << endl
#define print(x) cout << x << endl

// var
int N;
double V;
double A[22], B[22];

int main() {

	// solve
	scanf("%d %lf",&N,&V);
	fr(i,0,N) scanf("%lf",A+i);
	fr(i,0,N) scanf("%lf",B+i);

	double tot = 1e100, sA = 0;
	fr(i,0,N) tot = min(B[i]/A[i],tot), sA += A[i]; tot *= sA;

	printf("%lf\n",min(V,tot));

	return 0;
}


// Kim Vyacheslav Karaganda KTL
// 2010
#include <cstdio>

using namespace std;

#define min(a, b) (a<b?a:b)

int n, v, a[29], b[29];
double c[29], m = 999999999, r;

int main ()
{
    scanf ("%d%d", &n, &v);
    for (int i = 0; i < n; i++)
        scanf ("%d", &a[i]);
    for (int i = 0; i < n; i++)
    {
        scanf ("%d", &b[i]);
        c[i] = b[i] / a[i];
        m = min (c[i], m);
    }
    for (int i = 0; i < n; i++)
        r += a[i] * m;
    if (r < v) printf ("%lf", r);
    else printf ("%d", v);

    return 0;
}


// Kim Vyacheslav Karaganda KTL
// 2010
#include <cstdio>

using namespace std;

#define min(a, b) (a<b?a:b)

int n, v, a[29], b[29];
double c[29], m = 999999999, r;

int main ()
{
    scanf ("%d%d", &n, &v);
    for (int i = 0; i < n; i++)
        scanf ("%d", &a[i]);
    for (int i = 0; i < n; i++)
    {
        scanf ("%d", &b[i]);
        c[i] = b[i] / a[i];
        m = min (c[i], m);
    }
    if (!m)
    {
        puts ("0");
        return 0;
    }
    for (int i = 0; i < n; i++)
        r += a[i] * m;
    if (r < v) printf ("%lf", r);
    else printf ("%d", v);

    return 0;
}


// Kim Vyacheslav Karaganda KTL
// 2010
#include <cstdio>

using namespace std;

#define min(a, b) (a<b?a:b)

int n;
double c[29], m = 999999999, r, v, a[29], b[29];

int main ()
{
    scanf ("%d%lf", &n, &v);
    for (int i = 0; i < n; i++)
        scanf ("%lf", &a[i]);
    for (int i = 0; i < n; i++)
    {
        scanf ("%lf", &b[i]);
        c[i] = b[i] / a[i];
        m = min (c[i], m);
    }
    for (int i = 0; i < n; i++)
        r += a[i] * m;
    if (r < v) printf ("%.10lf", r);
    else printf ("%lf", v);

    return 0;
}


// Kim Vyacheslav Karaganda KTL
// 2010
#include <cstdio>

using namespace std;

#define min(a, b) (a<b?a:b)

int n, v, a[29], b[29];
double c[29], m = 999999999, r;

int main ()
{
    scanf ("%d%d", &n, &v);
    for (int i = 0; i < n; i++)
        scanf ("%d", &a[i]);
    for (int i = 0; i < n; i++)
    {
        scanf ("%d", &b[i]);
        if (a[i]) c[i] = b[i] / a[i];
        else c[i] = 999999999;
        m = min (c[i], m);
    }
    if (!m)
    {
        puts ("0");
        return 0;
    }
    for (int i = 0; i < n; i++)
        r += a[i] * m;
    if (r < v) printf ("%lf", r);
    else printf ("%d", v);

    return 0;
}


#include <cstdio>

using namespace std;

#define min(a, b) (a<b?a:b)

int n, v, a[29], b[29];
double c[29], m = 999999999, r;

int main ()
{
    scanf ("%d%d", &n, &v);
    for (int i = 0; i < n; i++)
        scanf ("%d", &a[i]);
    for (int i = 0; i < n; i++)
    {
        scanf ("%d", &b[i]);
        c[i] = b[i] / a[i];
        m = min (c[i], m);
    }
    for (int i = 0; i < n; i++)
        r += a[i] * m;
    if (r < v) printf ("%.10lf", r);
    else printf ("%d", v);

    return 0;
}


#include<iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>

using namespace std;
int a[111111],b[11111],dp[4111][3];
int n,l=0,m,x,y,ans;

int main() {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
 int t=0,n2=0,j,i,z=0,n=0,m=0;
 cin>>n>>t;
 for (i=0;i<n;i++) {cin>>a[i];z+=a[i];}
 for (i=0;i<n;i++) cin>>b[i];
 double d=t/z;
 for (i=0;i<n;i++)
  if (b[i]/a[i]<d) d=1.*b[i]/a[i];
// cout<<d<<' ';
 if (d>t) cout<<t; else printf("%.7f",d*z);
  //system("pause");
}


#include<iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>

using namespace std;
int a[111111],b[11111],dp[4111][3];
int n,l=0,m,x,y,ans;

int main() {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
 int t=0,n2=0,j,i,z=0,n=0,m=0;
 cin>>n>>t;
 for (i=0;i<n;i++) {cin>>a[i];z+=a[i];}
 for (i=0;i<n;i++) cin>>b[i];
 double d=10000,dd;
 for (i=0;i<n;i++) {
  dd=double(b[i])/double(a[i]);
  if (dd<d) d=dd;
  }
 if (d*z>t) cout<<t; else printf("%.7f",d*z);
  //system("pause");
}


#include<iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>

using namespace std;
int a[111111],b[11111],dp[4111][3];
int n,l=0,m,x,y,ans;

int main() {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
 int t=0,n2=0,j,i,z=0,n=0,m=0;
 cin>>n>>t;
 for (i=0;i<n;i++) {cin>>a[i];z+=a[i];}
 for (i=0;i<n;i++) cin>>b[i];
 double d=1000;
 for (i=0;i<n;i++)
  if (b[i]/a[i]<d) d=1.*b[i]/a[i];
// cout<<d<<' ';
 d=d*z;
 if (d>t) cout<<t; else printf("%.7f",d);
  //system("pause");
}


#include<iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>

using namespace std;
int a[111111],b[11111],dp[4111][3];
int n,l=0,m,x,y,ans;

int main() {
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
 int t=0,n2=0,j,i,z=0,n=0,m=0;
 cin>>n>>t;
 for (i=0;i<n;i++) {cin>>a[i];z+=a[i];}
 for (i=0;i<n;i++) cin>>b[i];
 double d=t/z,dd;
 for (i=0;i<n;i++) {
  dd=double(b[i])/double(a[i]);
  if (dd<d) d=dd;
}
// cout<<d<<' ';
 if (d>t) cout<<t; else printf("%.7f",d*z);
  //system("pause");
}


#include<iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstring>

using namespace std;
int a[111111],b[11111],dp[4111][3];
int n,l=0,m,x,y,ans;

int main() {
 // freopen("input.txt","r",stdin);
 // freopen("output.txt","w",stdout);
 int t=0,n2=0,j,i,z=0,n=0,m=0;
 cin>>n>>t;
 for (i=0;i<n;i++) {cin>>a[i];z+=a[i];}
 for (i=0;i<n;i++) cin>>b[i];
 long double d=1000;
 for (i=0;i<n;i++)
  if (b[i]/a[i]<d) d=b[i]/a[i];

 d=d*z;
 if (d>t) cout<<t; else cout<<d;
  //system("pause");
}


#include<iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstring>

using namespace std;
int a[111111],b[11111],dp[4111][3];
int n,l=0,m,x,y,ans;

int main() {
 // freopen("input.txt","r",stdin);
 // freopen("output.txt","w",stdout);
 int t=0,n2=0,j,i,z=0,n=0,m=0;
 cin>>n>>t;
 for (i=0;i<n;i++) cin>>a[i];
 for (i=0;i<n;i++) cin>>b[i];
 long double d=1000;
 for (i=0;i<n;i++)
  if (b[i]/a[i]<d) d=b[i]/a[i];

 d=d*n;
 if (d>t) cout<<t; else cout<<d;
  //system("pause");
}


#include<iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>

using namespace std;
int a[111111],b[11111],dp[4111][3];
int n,l=0,m,x,y,ans;

int main() {
 // freopen("input.txt","r",stdin);
 // freopen("output.txt","w",stdout);
 int t=0,n2=0,j,i,z=0,n=0,m=0;
 cin>>n>>t;
 for (i=0;i<n;i++) {cin>>a[i];z+=a[i];}
 for (i=0;i<n;i++) cin>>b[i];
 double d=t/z;
 for (i=0;i<n;i++) {
  if (1.0*b[i]/a[i]<d) d=1.*b[i]/a[i];

}
 //cout<<d<<' ';
 if (d>t) cout<<t; else printf("%.7f",d*z);
  //system("pause");
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int n, v;
    cin >> n >> v;
    vector <int> a(n), b(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];
    for(int i=0; i<n; ++i)
        cin >> b[i];
    double m = 1000*1000*1000, res = 0.00;
    for(int i=0; i<n; ++i)
        m = min(m, (double)b[i]/a[i]);
    for(int i=0; i<n; ++i)
        res += a[i]*m;
    res = min((double)v, res);
    printf("%.4lf\n", res);

    return 0;
}


#include <cstdio>
#include <iostream>

using namespace std;

int main() {
    int n, v;
    cin >> n >> v;
    vector <int> a(n), b(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];
    for(int i=0; i<n; ++i)
        cin >> b[i];
    double m = 1000*1000*1000, res = 0.00;
    for(int i=0; i<n; ++i)
        m = min(m, (double)b/a);
    for(int i=0; i<n; ++i)
        res += a[i]*m;
    res = min(v, res);
    printf("%.4lf\n", res);

    return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, v;
    cin >> n >> v;
    vector <int> a(n), b(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];
    for(int i=0; i<n; ++i)
        cin >> b[i];
    double m = 1000*1000*1000, res = 0.00;
    for(int i=0; i<n; ++i)
        m = min(m, (double)b/a);
    for(int i=0; i<n; ++i)
        res += a[i]*m;
    res = min(v, res);
    printf("%.4lf\n", res);

    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n, v;
    cin >> n >> v;
    vector <int> a(n), b(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];
    for(int i=0; i<n; ++i)
        cin >> b[i];
    double m = 1000*1000*1000, res = 0.00;
    for(int i=0; i<n; ++i)
        m = min(m, (double)b[i]/a[i]);
    for(int i=0; i<n; ++i)
        res += a[i]*m;
    res = min((double)v, res);
    printf("%.4lf\n", res);

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int i,n,a[1001], b[1001] ,sa,j;
double x[1001], sb,v;
int main(){
    cin>>n>>v;
    for(i=0;i<n;++i){
        cin>>a[i];
        sa+=a[i];
    }
    for(i=0;i<n;++i) {
        cin>>b[i];
        x[i] = b[i]/a[i];
    }
    sort(x,x+n);
    for(i=n-1;i>=0;--i){
        int fl =0 ;sb = 0;
        for(j=0;j<n;++j){
            if (a[j]*x[i]>b[j]) {fl++; break;}
            else sb += a[j]*x[i];
        }
        if (!fl && sb<=v) {cout<<i<<endl;printf("%1lf", sb); return 0;}
    }
    printf("%1lf", v);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int i,n,a[1001], b[1001] ,sa,j;
double x[1001], sb,v;
int main(){
    cin>>n>>v;
    for(i=0;i<n;++i){
        cin>>a[i];
        sa+=a[i];
    }
    for(i=0;i<n;++i) {
        cin>>b[i];
        x[i] = b[i]/a[i];
    }
    sort(x,x+n);
    for(i=n-1;i>=0;--i){
        int fl =0 ;sb = 0;
        for(j=0;j<n;++j){
            if (a[j]*x[i]>b[j]) {fl++; break;}
            else sb += a[j]*x[i];
        }
        if (!fl && sb<=v) {printf("%1lf", sb); return 0;}
    }
    printf("%1lf", v);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int i,n,a[1001], b[1001] ,sa,j;
double x=1e9, sb,v,s;
int main(){
    cin>>n>>v;
    for(i=0;i<n;++i){
        cin>>a[i];
        sa+=a[i];
    }
    for(i=0;i<n;++i) {
        cin>>b[i];
        sb = (double)b[i]/a[i];
        if (sb<x) x = sb;
    }
    s=0;
    for(i=0;i<n;++i){
        s += a[i]*x;
    }
    if (s<=v) {printf("%5lf",s); return 0;}
    printf("%5lf",v);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int i,n,a[1001], b[1001] ,sa,j;
double x[1001], sb,v;
int main(){
    cin>>n>>v;
    for(i=0;i<n;++i){
        cin>>a[i];
        sa+=a[i];
    }
    for(i=0;i<n;++i) {
        cin>>b[i];
        x[i] = b[i]/a[i];
    }
    sort(x,x+n);
    for(i=n-1;i>=0;--i){
        int fl =0 ;
        for(j=0;j<n;++j)
            if (a[j]*x[i]>b[j]) {fl++; break;}
            else sb += a[j]*x[i];
        if (!fl && sb<=v) {printf("%5lf", sb); return 0;}
    }
    printf("%5lf", v);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int i,n,a[1001], b[1001] ,sa,j;
double x[1001], sb,v;
int main(){
    cin>>n>>v;
    for(i=0;i<n;++i){
        cin>>a[i];
        sa+=a[i];
    }
    for(i=0;i<n;++i) {
        cin>>b[i];
        x[i] = b[i]/a[i];
    }
    sort(x,x+n);
    for(i=n-1;i>=0;--i){
        int fl =0 ;
        for(j=0;j<n;++j)
            if (a[j]*x[i]>b[j]) {fl++; break;}
            else sb += a[j]*x[i];
        if (!fl && sb<=v) {printf("%1lf", sb); return 0;}
    }
    printf("%1lf", v);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
vector<double> a,b;
int main(){
  int i,j,n;
  double V,x,P;
  //system("pause");
  cin>>n>>V;
  for(i=0;i<n;++i){
   cin>>x;
   a.push_back(x);
                  }
  for(i=0;i<n;++i){
   cin>>x;
   b.push_back(x);
                  }
  P=1E9;
  for(i=0;i<n;++i) P=min(P,b[i]/a[i]);
  x=0;
  for(i=0;i<n;++i)x+=P*a[i];
  printf("%.12lf\n",min(V,x));
  //system("pause");
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<double> a,b;
int main(){
  int i,j,n;
  double V,x,P;
  //system("pause");
  cin>>n>>V;
  for(i=0;i<n;++i){
   cin>>x;
   a.push_back(x);
                  }
  for(i=0;i<n;++i){
   cin>>x;
   b.push_back(x);
                  }
  P=1E9;
  for(i=0;i<n;++i) P=min(P,b[i]/a[i]);
  x=0;
  for(i=0;i<n;++i)x+=P*a[i];
  printf("%.12lf\n",min(V,x));
  //system("pause");
  return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

class Item {
public:
	int a,b;
	double ab;
	bool operator<(const Item &other) const {
		return ab < other.ab;
	}
};
Item items[20];

int main() {
	int n, V;
	scanf("%d %d", &n, &V);
	int sum = 0;

	for ( int i = 0; i < n; i++ ) {
		scanf("%d", &items[i].a);
		sum += items[i].a;
	}

	for ( int i = 0; i < n; i++ ) {
		scanf("%d", &items[i].b);
		items[i].ab = items[i].b*1.0/items[i].a;
	}

	double mm = min_element(items, items+n)->ab;
	double ret = mm*sum;
	printf("%lf\n", min(ret,(double)V));
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

class Item {
public:
	int a,b;
	double ab;
	bool operator<(const Item &other) const {
		return ab < other.ab;
	}
};
Item items[20];

int main() {
	int n, V;
	scanf("%d %d", &n, &V);
	for ( int i = 0; i < n; i++ )
		scanf("%d", &items[i].a);
	for ( int i = 0; i < n; i++ ) {
		scanf("%d", &items[i].b);
		items[i].ab = items[i].b*1.0/items[i].a;
	}

	double mm = min_element(items, items+n)->ab;
	double ret = 0;
	for ( int i = 0; i < n; i++ )
		ret += mm*items[i].a;
	printf("%0.1lf\n", min(ret,(double)V));
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

class Item {
public:
	int a,b;
	double ab;
	bool operator<(const Item &other) const {
		return ab < other.ab;
	}
};
Item items[20];

int main() {
	int n, V;
	scanf("%d %d", &n, &V);
	for ( int i = 0; i < n; i++ )
		scanf("%d", &items[i].a);
	for ( int i = 0; i < n; i++ ) {
		scanf("%d", &items[i].b);
		items[i].ab = items[i].b/items[i].a;
	}

	double mm = min_element(items, items+n)->ab;
	double ret = 0;
	for ( int i = 0; i < n; i++ )
		ret += mm*items[i].a;
	printf("%0.1lf\n", min(ret,(double)V));
}


#include <bits/stdc++.h>
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
int main()
{
    int n,v;
    scanf("%d%d",&n,&v);
    int a[n];
    int b[n];
    int sum1=0;
    for (int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum1=sum1+a[i];
    }
    for (int i=0;i<n;i++)
    scanf("%d",&b[i]);
    double x=v/(1.0*sum1);
    double sum2=0.0;
    double mini=(1.0*b[0])/(1.0*a[0]);
    for (int i=1;i<n;i++)
    mini=min(mini,(1.0*b[i])/(1.0*a[i]));
    for (int i=0;i<n;i++)
    {
        sum2=sum2+min(1.0*mini*a[i],1.0*a[i]*x);
    }
    cout<<fixed<<setprecision(10)<<sum2<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
double a[10000];
double b[10000];
int main()
{
    double n, v, mi = 1000, sum = 0;

    cin >> n >> v;

    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    for(int i = 0;i < n;i++)
    {
        cin >> b[i];
    }

    for(int i = 0;i < n;i++)
    {
        mi = min(mi, (b[i] / a[i]));
    }

    for(int i = 0;i < n;i++)
    {
        sum += mi * a[i];
    }

    if(sum > v) printf("%lf\n", v);
    else printf("%lf\n", sum);

    return 0;

}


#include<bits/stdc++.h>
using namespace std;
int a[1000000];
int main()
{
    int n, v, b = INT_MAX, vol = 0, val;

    cin >> n >> v;

    for(int i = 0; i < n;i++)
    {
        cin >> a[i];
    }

    for(int i = 0;i < n;i++)
    {
        cin >> val;
        b = min(b, val);
    }
    //cout << b << endl;
    for(int i = 0;i < n;i++)
    {
        vol += b*a[i];
    }
    if(vol > v) cout << v <<".0"<< endl;
    else cout << vol <<".0"<< endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.second>b.second;
}

/*
Mistakes

- while using pairs make sure you comparator datatype it's int by default change it as per the need
- Modify comparator if you want to
*/
#define ll long long int
#define f first
#define s second
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll64 int64_t
#define pb push_back
#define pll pair<long long int,long long int>
#define pi pair<int,int>
#define mi map<int,int>
#define mll map<long long int,long long int>
#define umi unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define vpi vector<pair<int,int>>
#define vpll vector<pair<long long int,long long int>>
#define mod 1000000007
#define fp(i,x,n) for(int i=x;i<n;i++)
#define fn(i,x,n) for(int i=x;i>n;i--)
#define fpm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define asort_vp_second(vect) sort(vect.begin(), vect.end(), sortbysec)
#define asort_vp_first(vect) sort(vect.begin(), vect.end())
#define dsort_vp_first(vect) sort(vect.begin(), vect.end(), sortinrev)
#define dsort_vp_second(vect) sort(vect.begin(), vect.end(), sortbysecdesc)
#define vi vector<int>
#define vll vector<long long int>
#define c(x) cout<<x<<endl;

int main()
{
	int n,V,a;
	cin>>n>>V;
	double sum=0,b[n];
	fp(i,0,n)
	{
	    cin>>a;
	    sum+=a;
	}
	fp(i,0,n)
	{
	    cin>>b[i];
	}
	double x = *min_element(b,b+n);
	double y = V/sum;
	if(x>=y)
	{
	    cout<<setprecision(6)<<y*sum<<endl;
	}else
	{
	    cout<<setprecision(6)<<x*sum<<endl;
	}
}


#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.second>b.second;
}

/*
Mistakes

- while using pairs make sure you comparator datatype it's int by default change it as per the need
- Modify comparator if you want to
*/
#define ll long long int
#define f first
#define s second
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll64 int64_t
#define pb push_back
#define pll pair<long long int,long long int>
#define pi pair<int,int>
#define mi map<int,int>
#define mll map<long long int,long long int>
#define umi unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define vpi vector<pair<int,int>>
#define vpll vector<pair<long long int,long long int>>
#define mod 1000000007
#define fp(i,x,n) for(int i=x;i<n;i++)
#define fn(i,x,n) for(int i=x;i>n;i--)
#define fpm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define asort_vp_second(vect) sort(vect.begin(), vect.end(), sortbysec)
#define asort_vp_first(vect) sort(vect.begin(), vect.end())
#define dsort_vp_first(vect) sort(vect.begin(), vect.end(), sortinrev)
#define dsort_vp_second(vect) sort(vect.begin(), vect.end(), sortbysecdesc)
#define vi vector<int>
#define vll vector<long long int>
#define c(x) cout<<x<<endl;
int main()
{
    FIO;
    int n;
    int v;
    cin>>n>>v;
    cout << fixed << setprecision(4);
    double a[n],b[n],x=INT_MAX;
    fp(i,0,n)
    cin>>a[i];

    fp(i,0,n)
    cin>>b[i];

    fp(i,0,n)
    {
        x = min(x ,(double) b[i]/a[i]);
    }
    int x1=0;
    fp(i,0,n)
    {
        x1  += a[i];
    }
    cout<<min(x1*x,(double)v)<<endl;
}


#include<iostream>
using namespace std;
#include<set>
int arr[101];
int arr2[101];
int main()
{
	int n,v;
	cin>>n>>v;
	set<int> s;
	for(int i=0;i<n;++i)
		cin>>arr[i];
	for(int i=0;i<n;++i)
		cin>>arr2[i];

	for(int i=0;i<n;++i)
	{
		s.insert(arr2[i]/arr[i]);
	}

	int c=0;
	for(int i=0;i<n;++i)
	{
		c+=*s.begin()*arr[i];
	}

	if(c>v)
		cout<<v;
	else
		cout<<c;
return 0;
}


#include<iostream>
using namespace std;
#include<set>
#include<iomanip>
int arr[101];
int arr2[101];
int main()
{
	int n,v;
	cin>>n>>v;
	set<double> s;
	int sum=0;
	for(int i=0;i<n;++i)
	{
		cin>>arr[i];
		sum+=arr[i];
	}

	for(int i=0;i<n;++i)
		cin>>arr2[i];

	for(int i=0;i<n;++i)
	{
		s.insert((double)arr2[i]/arr[i]);
	}

	if((double)*s.begin()*sum>v)
		cout<<v;
	else
		cout<<std::fixed<<std::setprecision(13)<<(double)*s.begin()*sum;

return 0;
}


/*
 *  Author :: Kattu37
 */

#include<bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define PI 3.14159265358979

typedef long long ll;

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,v;
	cin>>n>>v;

	vector<int> a(n),b(n);
	double m=INT_MAX;
	int sum=0;

	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
		m=min(m,(double)b[i]/a[i]);
	}

	m=min(m,(double)v/sum);
	cout<<fixed<<sum*m<<setprecision(6)<<"\n";

	return 0;
}


 /*                  *
 * $HIMANSHU PANDEY$  *
 *                  *
 *~~~~~~~~~~~~~~~~~~*/
//
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define sp system("pause")
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define REP(i,n) FOR(i,0,(int)n-1)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,1,sizeof(x))
#define SORT(a,n) sort(begin(a),begin(a)+n)
#define REV(a,n) reverse(begin(a),begin(a)+n)
#define lld long long int
#define pii pair<int,int>
#define MOD 1000000007
#define INF (ll)100000000000000000
int main()
{
    lld n,v,i;
    cin>>n>>v;
    double a[n+1],b[n+1],s=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    //s=(double)s;
    double r=v/(double)s;
    //printf("%.5lf",r);
      cin>>b[0];
     double k=b[0]/a[0];
    for(i=1;i<n;i++)
    {
        cin>>b[i];
        double r1=b[i]/a[i];
        k=min(k,r1);
    }
    k=(double)(k);
    double t;
    if(k<r)
    {
        t=k;
    }
    else

    {
        t=r;
    }
  double p=t*s;
    printf("%.5lf",p);
    return 0;
}


 /*                  *
 * $HIMANSHU PANDEY$  *
 *                  *
 *~~~~~~~~~~~~~~~~~~*/
//
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define sp system("pause")
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define REP(i,n) FOR(i,0,(int)n-1)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,1,sizeof(x))
#define SORT(a,n) sort(begin(a),begin(a)+n)
#define REV(a,n) reverse(begin(a),begin(a)+n)
#define lld long long int
#define pii pair<int,int>
#define MOD 1000000007
#define INF (ll)100000000000000000
int main()
{
    lld n,v,k,i;
    cin>>n>>v;
    lld a[n+1],b[n+1],s=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    double r=v/s;
      cin>>b[0];
      k=b[0];
    for(i=1;i<n;i++)
    {
        cin>>b[i];
        k=min(k,b[i]);
    }
    k=(double)(k);
    double t;
    if(k<r)
    {
        t=k;
    }
    else
    {
        t=r;
    }
   double p=t*n;
    printf("%.4lf",p);
    return 0;
}


 /*                  *
 * $HIMANSHU PANDEY$  *
 *                  *
 *~~~~~~~~~~~~~~~~~~*/
//
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define sp system("pause")
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define REP(i,n) FOR(i,0,(int)n-1)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,1,sizeof(x))
#define SORT(a,n) sort(begin(a),begin(a)+n)
#define REV(a,n) reverse(begin(a),begin(a)+n)
#define lld long long int
#define pii pair<int,int>
#define MOD 1000000007
#define INF (ll)100000000000000000
int main()
{
    lld n,v,i;
    cin>>n>>v;
    lld a[n+1],b[n+1],s=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    double r=v/s;
      cin>>b[0];
     double k=b[0]/a[0];
    for(i=1;i<n;i++)
    {
        cin>>b[i];
        double r1=b[i]/a[i];
        k=min(k,r1);
    }
    k=(double)(k);
    double t;
    if(k<r)
    {
        t=k;
    }
    else

    {
        t=r;
    }
  double p=t*s;
    printf("%.4lf",p);
    return 0;
}


/*                  *
 * $HIMANSHU PANDEY$  *
 *                  *
 *~~~~~~~~~~~~~~~~~~*/
//
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define sp system("pause")
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define REP(i,n) FOR(i,0,(int)n-1)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,1,sizeof(x))
#define SORT(a,n) sort(begin(a),begin(a)+n)
#define REV(a,n) reverse(begin(a),begin(a)+n)
#define lld long long int
#define pii pair<int,int>
#define MOD 1000000007
#define INF (ll)100000000000000000
int main()
{
    lld n,v,i;
    cin>>n>>v;
    double a[n+1],b[n+1],s=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    //cout<<s;
    double r=v/(double)s;
      cin>>b[0];
    //cout<<r;
     double k=b[0]/a[0];
    for(i=1;i<n;i++)
    {
        cin>>b[i];
        double r1=b[i]/a[i];
        k=min(k,r1);
    }
    k=(double)(k);
    double t;
    if(k<r)
    {
        t=k;
    }
    else

    {
        t=r;
    }
  double p=t*s;
    printf("%.4lf",p);
    return 0;
}


#include<iostream>
#include<iomanip>
using namespace std;
int num1[21];
int num2[21];
double num3[21];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> num2[i];
	for (int i = 0; i < n; i++)
		cin >> num3[i];
	for (int i = 0; i < n; i++)
		num3[i] /= num2[i];
	int min = 0;
	for (int i = 0; i < n;i++)
	if (num3[min]>num3[i]) min = i;
	double sum = 0;
	for (int i = 0; i < n; i++)
		sum += num3[min] * num2[i];
	if (sum>m)sum = m;
	cout << fixed << setprecision(1) << sum << endl;

}


#include<iostream>
#include<iomanip>
using namespace std;
int num1[21];
int num2[21];
double num3[21];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> num2[i];
	for (int i = 0; i < n; i++)
		cin >> num3[i];
	for (int i = 0; i < n; i++)
		num3[i] /= num2[i];
	int min = 0;
	for (int i = 0; i < n;i++)
	if (num3[min]>num3[i]) min = i;
	double sum = 0;
	for (int i = 0; i < n; i++)
		sum += num3[min] * num2[i];
	if (sum>m)sum = m;
	cout  << sum << endl;

}


#include<iostream>
#include<iomanip>
using namespace std;
int num1[21];
int num2[21];
double num3[21];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> num2[i];
	for (int i = 0; i < n; i++)
		cin >> num3[i];
	for (int i = 0; i < n; i++)
		num3[i] /= num2[i];
	int min = 0;
	for (int i = 0; i < n;i++)
	if (num3[min]>num3[i]) min = i;
	double sum = 0;
	for (int i = 0; i < n; i++)
		sum += num3[min] * num2[i];
	if (sum>m)sum = m;
	cout << fixed << setprecision(1) << sum << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
using namespace std;
int num1[21];
int num2[21];
double num3[21];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> num2[i];
	for (int i = 0; i < n; i++)
		cin >> num3[i];
	for (int i = 0; i < n; i++)
		num3[i] /= num2[i];
	int min = 0;
	for (int i = 0; i < n;i++)
	if (num3[min]>num3[i]) min = i;
	double sum = 0;
	for (int i = 0; i < n; i++)
		sum += num3[min] * num2[i];
	cout << fixed << setprecision(1) << sum << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
using namespace std;
int num1[21];
int num2[21];
double num3[21];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> num2[i];
	for (int i = 0; i < n; i++)
		cin >> num3[i];
	for (int i = 0; i < n; i++)
		num3[i] /= num2[i];
	int min = 0;
	for (int i = 0; i < n;i++)
	if (num3[min]>num3[i]) min = i;
	double sum = 0;
	for (int i = 0; i < n; i++)
		sum += num3[min] * num2[i];
	if (sum>m)
	{
		sum = m;
	}
	cout  << sum << endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,v;cin>>n>>v;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
        cin>>b[i];
    double min1=INT_MAX;
    long long sum=0;
    for(int i=0;i<n;i++)
        sum+=a[i];
    min1=double(v)/sum;
    for(int i=0;i<n;i++)
        min1=min(min1,double(b[i])/a[i]);
    printf("%.6lf\n",min1*sum);
    return 0;
}


#include<bits/stdc++.h>
#include <cctype>
using namespace std;
#define ll long long
#define nas string::npos
#define ld long double
int main()
{
  ll n,i;
  ld min=101.0,sum=0.0,v;cin>>n>>v;
  ld a[n];
  ld b[n];
  ld c[n];
  for(i=0;i<n;i++){cin>>a[i];sum=sum+a[i];}
  for(i=0;i<n;i++){cin>>b[i];c[i]=b[i]/a[i];if(c[i]<min)min=c[i];}
ld k=min*sum;
if(k>v)printf("%.6Lf",v);
else printf("%.6Lf",k);;
return 0;
}


#include<bits/stdc++.h>
#include <cctype>
using namespace std;
#define ll long long
#define nas string::npos
#define ld long double
int main()
{
  ll n,i,sum=0;
  ld min=101.0,v;cin>>n>>v;
  ll a[n];
  ll b[n];
  ll c[n];
  for(i=0;i<n;i++){cin>>a[i];sum=sum+a[i];}
  for(i=0;i<n;i++){cin>>b[i];c[i]=b[i]/a[i];if(c[i]<min)min=c[i];}
ld k=min*sum;

if(k>v)cout<<v;
else cout<<k;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
void dfs(vector<bool>&boolean,int &ans,int st,vector<int>&v)
{
    if(boolean[st]==true){ans=st;return;}
    boolean[st]=true;
    dfs(boolean,ans,v[st],v);
    return;
}
int power(int x, int y, int p)
{
    int res = 1;      // Initialize result

    x = x % p;

    while (y > 0)
    {
         if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}
int nCrModPFermat(int n, int r, int p)
{
   // Base case
   if (r==0)
      return 1;
    int fac[n+1];
    fac[0] = 1;
    for (int i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
}
int main()
{
ll n,i;
double v;
cin>>n>>v;
double a[n+1],b[n+1];
for(i=0;i<n;i++)cin>>a[i];
for(i=0;i<n;i++)cin>>b[i];
double sum=0;
for(i=0;i<n;i++)sum+=a[i];
double mn=(double)v/sum;
for(i=0;i<n;i++)
{
 double x = b[i]/a[i];
 if(mn>x)mn=x;
}
double num1 = sum*mn;
 cout << fixed << showpoint;
    cout << setprecision(6);
    cout << num1 << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
void dfs(vector<bool>&boolean,int &ans,int st,vector<int>&v)
{
    if(boolean[st]==true){ans=st;return;}
    boolean[st]=true;
    dfs(boolean,ans,v[st],v);
    return;
}
int power(int x, int y, int p)
{
    int res = 1;      // Initialize result

    x = x % p;

    while (y > 0)
    {
         if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}
int nCrModPFermat(int n, int r, int p)
{
   // Base case
   if (r==0)
      return 1;
    int fac[n+1];
    fac[0] = 1;
    for (int i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
}
int main()
{
ll n,i;
double v;
cin>>n>>v;
double a[n+1],b[n+1];
for(i=0;i<n;i++)cin>>a[i];
for(i=0;i<n;i++)cin>>b[i];
double sum=0;
for(i=0;i<n;i++)sum+=a[i];
double mn=(double)v/sum;
for(i=0;i<n;i++)
{
 double x = b[i]/a[i];
 if(mn>x)mn=x;
}
double num1 = sum*mn;
 cout << fixed << showpoint;
    cout << setprecision(2);
    cout << num1 << endl;
}


						//** be name khoda **//
#include<bits/stdc++.h>
using namespace std;
#define s second
#define f first
#define mp make_pair
#define pb push_back
typedef long long ll;

const int maxn = 20;
double a[maxn], v, javab = 0, b[maxn];
int n;

void input()
{
	cin >> n >> v;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int j = 0; j < n; j++)
		cin >> b[j];
}

void output()
{
	for(int i = 0; i < n; i++)
		b[i] /= (double) a[i];
	sort(b, b + n);
	for(int i = 0; i < n; i++)
		javab += (b[0] * a[i]);
	javab = min(v, javab);
	cout << fixed << setprecision(4) << javab << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	input();
	output();
	return 0;
}


						//** be name khoda **//
#include<bits/stdc++.h>
using namespace std;
#define s second
#define f first
#define mp make_pair
#define pb push_back
typedef long long ll;

const int maxn = 20;
double a[maxn], v, b[maxn];
int n;

void input()
{
	cin >> n >> v;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int j = 0; j < n; j++)
		cin >> b[j];
}

void output()
{
	for(int i = 0; i < n; i++)
		b[i] /= (double) a[i];
	sort(b, b + n);
	v = min(v, b[0] * (double) n);
	cout << fixed << setprecision(4) << v << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	input();
	output();
	return 0;
}


///   BISMILLAHIR RAHMANIR RAHEEM
///   ALLAH IS WATCHING ME
///   ALLAH save us from COVID-19.Amin.

///   Every soul shall taste death.

///   Tag ::

/*
                                 ---------------------------
                                    #BoycottFrenceProducts
                                 ---------------------------
*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

///  order_of_key return number of elements less than x.
///  find_by_order return index.
using namespace std;
using namespace __gnu_pbds;

#define MOHAMMAD        ios::sync_with_stdio(0);cin.tie(0);
#define all(x)          (x).begin(), (x).end()
#define AE              cout << fixed << setprecision(10);
#define ld              double

/// faster.
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

using ll = long long;
const ll MOD = 1e9 + 7 ;

bool check ( ll a , ll b ){
    return (a - (b*(a/b))) == 0;
}

typedef tree< int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

//debug
template<typename F,typename S>ostream&operator<<(ostream&os,const pair<F,S>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&v){os<<"{";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"}";}
template<typename T>ostream&operator<<(ostream&os,const set<T>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<",";os<<*it;}return os<<"]";}
template<typename T>ostream&operator<<(ostream&os,const multiset<T>&v) {os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"]";}
template<typename F,typename S>ostream&operator<<(ostream&os,const map<F,S>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<it->first<<" = "<<it->second;}return os<<"]";}
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu(){cerr << endl;}
template<typename T>void faltu(T a[],int n){for(int i=0;i<n;++i)cerr<<a[i]<<' ';cerr<<endl;}
template<typename T,typename...hello>void faltu(T arg,const hello&...rest){cerr<<arg<<' ';faltu(rest...);}
//#else
//#define dbg(args...)

/// Modular arithmetic
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }  /// When MOD is prime.
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

//***********************************************  The END **********************************************************************************************************************************
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll limit = (1LL<<64) - 1;
const ld EPS   = 1e-6;
const ll K = 1e3 + 1;

/// Global...

void solve ( ){

  ll n , V;
  cin >> n >> V;
  ll a[n] , b[n];

  for ( ll i = 0 ; i < n ; ++i ) cin >> a[i];
  for ( ll i = 0 ; i < n ; ++i ) cin >> b[i];

  ld lo = 0 , hi = V , mx = 0.0;

  while ( hi-lo>EPS ){
       ld middle = (lo+hi)/2;
       ld cur = 0;
       bool possible = true;
       for ( ll i = 0 ; i < n ; ++i ){
           ll limit = a[i]*middle;
           if ( limit > b[i] ) {
               possible = false;
               break;
           }
           cur+=limit;
       }
       if ( possible and cur>=mx and cur<=V ){
             mx = cur;
             lo = middle;
       }
       else {
            hi = middle;
       }
  }

  cout << mx << "\n";

  return;
}

int main()
{

    MOHAMMAD
    AE;

    int t = 1 , tc = 0;
    /// cin >> t;

    while ( t-- ){
       solve(  );
    }
}

/*
Explanation:

----------------------------------------------------------------------------------------------------------------

  Alhamdulillah
*/


///   BISMILLAHIR RAHMANIR RAHEEM
///   ALLAH IS WATCHING ME
///   ALLAH save us from COVID-19.Amin.

///   Every soul shall taste death.

///   Tag ::

/*
                                 ---------------------------
                                    #BoycottFrenceProducts
                                 ---------------------------
*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

///  order_of_key return number of elements less than x.
///  find_by_order return index.
using namespace std;
using namespace __gnu_pbds;

#define MOHAMMAD        ios::sync_with_stdio(0);cin.tie(0);
#define all(x)          (x).begin(), (x).end()
#define AE              cout << fixed << setprecision(10);
#define ld              double

/// faster.
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

using ll = long long;
const ll MOD = 1e9 + 7 ;

bool check ( ll a , ll b ){
    return (a - (b*(a/b))) == 0;
}

typedef tree< int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

//debug
template<typename F,typename S>ostream&operator<<(ostream&os,const pair<F,S>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&v){os<<"{";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"}";}
template<typename T>ostream&operator<<(ostream&os,const set<T>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<",";os<<*it;}return os<<"]";}
template<typename T>ostream&operator<<(ostream&os,const multiset<T>&v) {os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"]";}
template<typename F,typename S>ostream&operator<<(ostream&os,const map<F,S>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<it->first<<" = "<<it->second;}return os<<"]";}
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu(){cerr << endl;}
template<typename T>void faltu(T a[],int n){for(int i=0;i<n;++i)cerr<<a[i]<<' ';cerr<<endl;}
template<typename T,typename...hello>void faltu(T arg,const hello&...rest){cerr<<arg<<' ';faltu(rest...);}
//#else
//#define dbg(args...)

/// Modular arithmetic
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }  /// When MOD is prime.
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

//***********************************************  The END **********************************************************************************************************************************
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll limit = (1LL<<64) - 1;
const ld EPS   = 1e-6;
const ll K = 1e3 + 1;

/// Global...

void solve ( ){

  ll n , V;
  cin >> n >> V;
  ll a[n] , b[n];

  for ( ll i = 0 ; i < n ; ++i ) cin >> a[i];
  for ( ll i = 0 ; i < n ; ++i ) cin >> b[i];

  ld lo = 0 , hi = V , mx = 0.0;

  while ( hi-lo>EPS ){
       ld middle = (lo+hi)/2;
       ld cur = 0.0;
       bool possible = true;
       for ( ll i = 0 ; i < n ; ++i ){
           ld limit = a[i]*middle;
           if ( limit > b[i] ) {
               possible = false;
               break;
           }
           cur+=limit;
       }
       /// dbg ( middle , cur );
       if ( possible and cur>=mx and cur<=V ){
             mx = cur;
             lo = middle;
       }
       else {
            hi = middle;
       }
  }

  cout << mx << "\n";

  return;
}

int main()
{

    MOHAMMAD
    AE;

    int t = 1 , tc = 0;
    /// cin >> t;

    while ( t-- ){
       solve(  );
    }
}

/*
Explanation:

----------------------------------------------------------------------------------------------------------------

  Alhamdulillah
*/


/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
int main()
{
   float a[100];
   float b[100];
   int n,v;
   float m=10e6,s=0;
   cin>>n>>v;
   for(int i=0;i<n;i++)
   {
      cin>>a[i] ;
   }
   for(int i=0;i<n;i++)
   {
      cin>>b[i] ;
   }

   for(int i=0;i<n;i++)
   {
      if(b[i]/a[i]<m)
      m=b[i]/a[i];
   }
     for(int i=0;i<n;i++)
   {
      s=s+a[i]*m;
   }
      if(s<=(float)v)

   printf("%.4f",s);
   else
      printf("%.4f",(float)v);

}


#include<bits/stdc++.h>
#define F(i,n) for(int i=0;i<n;i++)
const int N=20+1;
using namespace std;
double a[N],b[N],v,sum_tengo=0;
int n;
bool valid(double x){
	double cont=0;
	F(i,n){
		double ria=x*a[i];
		if(ria>b[i])return false;
		cont+=(ria);

	}
	return cont<=v and cont<=sum_tengo;
}

double bisec(){
	double lo,hi,mi;
	lo=0,hi=v;
	int test=1e4;
	while(test-- and lo<hi){
		//para determinar todos sus posibles valores;
		double  mi = (lo + hi) / 2.0;
		if(valid(mi)) lo=mi;
		//cuando trabajas con flotantes no puedes reducir en una unidad;
		else hi=mi;
	}
	return lo;
}

int main(){
	cin>>n;
	cin>>v;
	F(i,n)cin>>a[i];
	F(i,n){cin>>b[i];
		sum_tengo+=b[i];
	}
	double aux=bisec();
	double ans=0;
	F(i,n){
		ans+=(aux*a[i]);
	}
	printf("%.4lf\n", ans);
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n, V, sum = 0;
    int a[21], b[21];
    double avg, x, ans = 0, Vol;

    cin>>n>>V;
    for(int i = 0; i < n; i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    avg = V/double(sum);
    for(int i = 0; i < n; i++)
        cin>>b[i];
    sort(b,b+n);
    if((double)b[0]>avg)
        x = avg;
    else
        x = (double)b[0];
    for(int i = 0; i < n; i++)
    {
        ans += (x*(double)a[i]);
        if(ans<=V)
            Vol = ans;
        else
            break;
    }
    cout<<fixed<<setprecision(10)<<Vol<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n, V, sum = 0;
    double a[21], b[21], x = 100, Vol = 0;

    cin>>n>>V;
    for(int i = 0; i < n; i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    for(int i = 0; i < n; i++)
    {
        cin>>b[i];
        x = min(x, b[i]/a[i]);
    }
    for(int i = 0; i < n; i++)
    {
        Vol += (x*a[i]);
        if(Vol>=V)
        {
            Vol = V;
            break;
        }
    }
    cout<<fixed<<setprecision(10)<<Vol<<endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;
typedef vector< int > vi;
typedef vector< ll > vl;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef vector< pii > vpii;         typedef map<ll, ll> mll;
typedef vector< pll > vpll;         typedef map<int,int> mii;
#define endl '\n'
#define forn(i,n) for(int i=0; i<n; i++)
#define rforn(i,n) for(int i=n-1; i>=0; i--)
#define all(x) x.begin(), x.end()
#define pr(x) cout << #x << "=" << x << endl
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define in insert

const ld eps=1e-7;
const ll m=1000000007;

void solve()
{
    int n, v;
    cin >> n >> v;
    cout << fixed << setprecision(4);
    vi a(n), b(n);
    forn(i, n)
        cin >> a[i];
    forn(i, n)
        cin >> b[i];
    double x=100;
    forn(i, n)
    {
        if((double)b[i]/a[i]<=x)
            x=(double)b[i]/a[i];
    }
    int sum=0;
    forn(i, n)
        sum+=a[i];
    cout << min(sum*x, (double)v) << endl;
    return;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
  //  cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 20+5;
int n,v;
int a[N],b[N];
bool check(long double x){
	long double ans=0;
	int mx=*max_element(a,a+n);
	for(int i=0;i<n;i++){
		if(a[i]*x>b[i]*mx)
			return 0;
		ans+=(long double)(a[i]*x)/mx;
	}
	return ans<=v;
}
int32_t main(){
	fastio
	cin>>n>>v;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++)
		cin>>b[i];
	long double l=0,r=1e18;
	for(int i=0;i<200;i++){
		long double mid=(l+r)/2;
		if(check(mid))
			l=mid;
		else
			r=mid;
	}
	long double ans=0;
	for(int i=0;i<n;i++)
		ans+=a[i]*l;
	int mx=*max_element(a,a+n);
	ans/=mx;
	cout<<fixed<<setprecision(12);
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 20+5;
int n,v;
int a[N],b[N];
bool check(long double x){
	long double ans=0;
	for(int i=0;i<n;i++){
		if(a[i]*x>b[i])
			return 0;
		ans+=a[i]*x;
	}
	return ans<=v;
}
int32_t main(){
	fastio
	cin>>n>>v;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++)
		cin>>b[i];
	long double l=0,r=v+1;
	while(r-l>1){
		int mid=(l+r)/2;
		if(check(mid))
			l=mid;
		else
			r=mid;
	}
	long double ans=0;
	for(int i=0;i<n;i++)
		ans+=a[i]*l;
	cout<<fixed<<setprecision(12);
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 20+5;
int n,v;
int a[N],b[N];
bool check(long double x){
	long double ans=0;
	for(int i=0;i<n;i++){
		if(a[i]*x>b[i])
			return 0;
		ans+=a[i]*x;
	}
	return ans<=v;
}
int32_t main(){
	fastio
	cin>>n>>v;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++)
		cin>>b[i];
	long double l=0,r=101;
	while(r-l>1){
		int mid=(l+r)/2;
		if(check(mid))
			l=mid;
		else
			r=mid;
	}
	long double ans=0;
	for(int i=0;i<n;i++)
		ans+=a[i]*l;
	cout<<fixed<<setprecision(12);
	cout<<ans<<endl;
}


#include <bits/stdc++.h>

#pragma GCC optimize("O2")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define rap(i,n,N) for(ll i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define piii pair<int,pii>
#define piiii pair<pii,pll>
#define psi pair<string,int>
#define endl '\n'
const int MAX = 1e5+5;
const ll MAX2 = 11;
const ll MOD = 1000000007;
const ll MOD2 = 1000005329;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 2000;

int n,z,y[MAX];
double k,x[MAX],mn;

int main(){
	cout<<fixed<<setprecision(10);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n>>k;
    rep(i,1,n)cin>>y[i], z+= y[i];
    rep(i,1,n)cin>>x[i];
    k/= z;
    mn = k;
    rep(i,1,n)mn = min(mn,x[i]/y[i]);
    cout<<mn*z<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

double a[105],b[105];
int main()
{
    double n,v,ai,bi,mini=100000;

    cin >> n >> v;

    for(int i = 0 ; i <n ; i++)
    {
        cin >> a[i];
    }
    for(int i = 0 ; i < n ;i++)
    {
        cin >> b[i];

        if(a[i]*b[i]<mini)
        {
            ai=a[i];
            bi=b[i];
            mini=a[i]*b[i];
        }
    }
    if(ai*bi*n<v)
    printf("%.1lf",ai*bi*n);
    else
        printf("%.1lf",v);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

double a[105],b[105];
int main()
{
    double n,v,ai,bi,mini=100000;

    cin >> n >> v;

    for(int i = 0 ; i <n ; i++)
    {
        cin >> a[i];
    }
    double x=100000,ans=0;
    for(int i = 0 ; i < n ;i++)
    {
        cin >> b[i];
        x=min(x,b[i]/a[i]);
    }
    for(int i = 0 ; i < n ; i++)
    {
        ans+=x*a[i];
    }
    if(ans<v)
    printf("%.4lf",ans);
    else
        printf("%.4lf",v);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

double a[105],b[105];
int main()
{
    double n,v,ai,bi,mini=100000;

    cin >> n >> v;

    for(int i = 0 ; i <n ; i++)
    {
        cin >> a[i];
    }
    for(int i = 0 ; i < n ;i++)
    {
        cin >> b[i];

        if(a[i]*b[i]<mini)
        {
            ai=a[i];
            bi=b[i];
            mini=a[i]*b[i];
        }
    }
    if(ai*bi*n<v)
    printf("%.4lf",ai*bi*n);
    else
        printf("%.4lf",v);
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <functional>
#include <utility>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
#define for0(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define forA(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define forD(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
#define deb(x) cout<< #x << "=" << x <<endl
#define all(a) a.begin(),a.end()
#define re(x) cin>>x
#define readarr(a,n) for0(i,n) cin>>a[i]
#define mod 1000000007
#define INF 1000000000000000003
#define ff first
#define ss second
#define pb push_back
#define pob pop_back
#define mp make_pair
#define endl "\n"

typedef long long int            ll;
typedef unsigned long long       ull;
typedef vector<int>              vi;
typedef pair<int, int>           pi;
typedef unordered_map<int, int>  mii;
typedef unordered_map<char, int> mci;
typedef unordered_set<int>       usi;

int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
// int min(int a,int b){if(a<b) return a; else return b;}
bool isPrime(int N){ for(int i=2;i*i<=N;++i){if(N%i==0) return false;}return true;}

void solve(){
	int n,v;
	re(n),re(v);
	vi arr(n);
	readarr(arr,n);
	vi l(n);
	readarr(l,n);
	double res=v;
	double ans=1e9;
	for0(i,n)
	ans=min(ans,double(l[i])/arr[i]);
	double sum=0;
	for0(i,n)
	sum+=arr[i]*ans;
	res=min(res,sum);
	cout << fixed << setprecision(1) <<res<<endl;

}

int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--){
      solve();
    }
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <functional>
#include <utility>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
#define for0(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define forA(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define forD(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
#define deb(x) cout<< #x << "=" << x <<endl
#define all(a) a.begin(),a.end()
#define re(x) cin>>x
#define readarr(a,n) for0(i,n) cin>>a[i]
#define mod 1000000007
#define INF 1000000000000000003
#define ff first
#define ss second
#define pb push_back
#define pob pop_back
#define mp make_pair
#define endl "\n"

typedef long long int            ll;
typedef unsigned long long       ull;
typedef vector<int>              vi;
typedef pair<int, int>           pi;
typedef unordered_map<int, int>  mii;
typedef unordered_map<char, int> mci;
typedef unordered_set<int>       usi;

int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
// int min(int a,int b){if(a<b) return a; else return b;}
bool isPrime(int N){ for(int i=2;i*i<=N;++i){if(N%i==0) return false;}return true;}

void solve(){
	int n,v;
	re(n),re(v);
	vi arr(n);
	readarr(arr,n);
	vi l(n);
	readarr(l,n);
	double res=v;
	double ans=1e9;
	for0(i,n)
	ans=min(ans,double(l[i])/arr[i]);
	double sum=0;
	for0(i,n)
	sum+=arr[i]*ans;
	res=min(res,sum);
	cout << fixed << setprecision(10) <<res<<endl;

}

int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--){
      solve();
    }
    return 0;
}


/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 2e5+2;

double eps = 1e-4;

void solve()
{
    int n, V;
    scn(n); scn(V);

    vi a(n), b(n);

    rep(i, 0, n)
    scn(a[i]);

    rep(i, 0, n)
    scn(b[i]);

    function<bool(double)> check = [&](double x) {
        double total = 0.0;
        rep(i, 0, n) {
            double here = x * (double) a[i];
            total += here;
            if(here > b[i]) {
                return 0;
            }
        }

        int fl = ceil(total);

        if(fl <= V)
            return 1;

        return fabs(V - total) <= eps ? 1 : 0;
    };

    double lo = 0.0, hi = *min_element(b.begin(), b.end()), x = 0.0;

    int iterations = 200;

    while(iterations --) {
        double mid = (lo + hi) / 2.0;
        if(check(mid)) {
            x = mid; lo = mid;
        } else {
            hi = mid;
        }
    }

    double ans = 0.0;

    rep(i, 0, n) {
        ans += a[i] * x;
    }

    printf("%.8lf", ans);
}

int main()
{
    int t = 1;
    // scn(t);
    while(t --) {
        solve();
    }
    return 0;
}


//I_F_A
#include "bits/stdc++.h"
using namespace std;

#define N 1000001
long double arr[N],brr[N],crr[N];
long long n,V;

bool func(){

	crr[0] = 0;
	long double sum=0;
	for(long long i=1;i<=n;i++){
		sum = sum  +crr[i];
	}
	if(sum <= V){

		for(long long i=1;i<=n;i++){

			if(crr[i] > brr[i]){

				return false;
			}
		}
		return true;
	}
	return false;
}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n >> V;

	for(long long i=1;i<=n;i++){

		cin >> arr[i];
	}

	for(long long i=1;i<=n;i++){

		cin >> brr[i];
	}

	long double left = 0 , right = 100000;
	long double ans = 0;

	long long counter = 10000000;
	while(left <= right && counter > 0){

		counter--;
		long double mid = (left + right)/2;

		for(long long i=1;i<=n;i++){

			crr[i] = arr[i]*mid;
		}

		if(func()){

			ans = mid;
			left = mid + 0.0000000001;
		}
		else{

			right = mid - 0.0000000001;
		}

	}
//	printf("%.12Lf\n",ans);
	long double fans = 0;
	for(long long i=1;i<=n;i++){

		fans = fans + ans*arr[i];
	}
	printf("%.12Lf\n",fans);
}


//I_F_A
#include "bits/stdc++.h"
using namespace std;

#define N 1000001
long double arr[N],brr[N],crr[N];
long long n,V;

bool func(){

	crr[0] = 0;
	long double sum=0;
	for(long long i=1;i<=n;i++){
		sum = sum  +crr[i];
	}
	if(sum <= V){

		for(long long i=1;i<=n;i++){

			if(crr[i] > brr[i]){

				return false;
			}
		}
		return true;
	}
	return false;
}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n >> V;

	for(long long i=1;i<=n;i++){

		cin >> arr[i];
	}

	for(long long i=1;i<=n;i++){

		cin >> brr[i];
	}

	long double left = 0 , right = 100000;
	long double ans = 0;

	long long counter = 10000000;
	while(left <= right && counter > 0){

		counter--;
		long double mid = (left + right)/2;

		for(long long i=1;i<=n;i++){

			crr[i] = arr[i]*mid;
		}

		if(func()){

			ans = mid;
			left = mid + 0.00001;
		}
		else{

			right = mid - 0.00001;
		}

	}
//	printf("%.12Lf\n",ans);
	long double fans = 0;
	for(long long i=1;i<=n;i++){

		fans = fans + ans*arr[i];
	}
	printf("%.12Lf\n",fans);
}


//I_F_A
#include "bits/stdc++.h"
using namespace std;

#define N 1000001
long double arr[N],brr[N],crr[N];
long long n,V;

bool func(){

	crr[0] = 0;
	long double sum=0;
	for(long long i=1;i<=n;i++){
		sum = sum  +crr[i];
	}
	if(sum <= V){

		for(long long i=1;i<=n;i++){

			if(crr[i] > brr[i]){

				return false;
			}
		}
		return true;
	}
	return false;
}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n >> V;

	for(long long i=1;i<=n;i++){

		cin >> arr[i];
	}

	for(long long i=1;i<=n;i++){

		cin >> brr[i];
	}

	long double left = 0 , right = 100000;
	long double ans = 0;

	long long counter = 1000000;
	while(left <= right && counter > 0){

		counter--;
		long double mid = (left + right)/2;

		for(long long i=1;i<=n;i++){

			crr[i] = arr[i]*mid;
		}

		if(func()){

			ans = mid;
			left = mid + 0.0001;
		}
		else{

			right = mid - 0.0001;
		}

	}
//	printf("%.12Lf\n",ans);
	long double fans = 0;
	for(long long i=1;i<=n;i++){

		fans = fans + ans*arr[i];
	}
	printf("%.12Lf\n",fans);
}


//kalyanchirla
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
#define int long long
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define csl ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007

int32_t main()
{
    csl;

    int n,V;
    cin >> n >> V;

    int arr[n];

    for(int i=0;i<n;i++) cin >> arr[i];

    int b[n];
    for(int i=0;i<n;i++)
    {
        cin >> b[i];
    }
    double store= double(10000000000);

    for(int i=0;i<n;i++)
    {
        double curr = (double(b[i])/double(arr[i]));
        store = min(curr,store);
    }
    double sum=0.0000;
    for(int i=0;i<n;i++)
    {
        sum+=(arr[i]*store);
        if(sum>double(V))
        {
            sum = double(V);
            break;
        }
    }
    cout << setprecision(5) << sum << "\n";
}


#include <bits/stdc++.h>

#define INF 1000000000
#define inf 2147483647
#define MOD 1000000007
#define pf push_front
#define pb push_back
#define ll long long
#define ios ios_base::sync_with_stdio(0)
#define fname ""
#define y1 gg
#define F first
#define S second
#define x1 wp
#define SZ(A) (int((A).size()))
#define deb(x) cerr << " | " << #x << " = " << x
#define ex exit(0)
#define runt assert(0)

using namespace std;

const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

const int drx[] = {2, 2, 1, 1, -1, -1, -2, -2};
const int dry[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int N = 400500;

int n, V;

double mn = INF, a[N], b[N], sum;

int main(){
    #ifndef ONLINE_JUDGE
    freopen(fname".in", "r", stdin);
    freopen(fname".out", "w", stdout);
    #endif

    cin >> n >> V;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i], mn = min(mn, b[i] / a[i]);
    for (int i = 1; i <= n; i++) sum += a[i] * mn;
    cout << fixed << setprecision(4) << sum;
    #ifndef ONLINE_JUDGE
       cerr << clock() << " ms";
    #endif
	return 0;
}


#include <bits/stdc++.h>

#define INF 1000000000000000000LL
#define inf 2147483647
#define MOD 1000000007
#define pf push_front
#define pb push_back
#define ll long long
#define ios ios_base::sync_with_stdio(0)
#define fname ""
#define y1 gg
#define F first
#define S second
#define x1 wp
#define SZ(A) (int((A).size()))
#define deb(x) cerr << " | " << #x << " = " << x
#define ex exit(0)
#define runt assert(0)

using namespace std;

const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

const int drx[] = {2, 2, 1, 1, -1, -1, -2, -2};
const int dry[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int N = 400500;

int n, V;

double ans, a[N], b[N];

int main(){
    #ifndef ONLINE_JUDGE
    freopen(fname".in", "r", stdin);
    freopen(fname".out", "w", stdout);
    #endif

    cin >> n >> V;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i];
    int l = 1;
    int r = 100000;
    while (l <= r){
    	int mid = (l + r) / 2;
    	bool ok = false;
    	double sum = 0;
    	for (int i = 1; i <= n; i++){
    		double x = a[i];
    		x *= mid;
    		if (x > b[i]){
    			ok = 1;
    			break;
    		}
    		sum += x;
    		if (sum > V){
    			ok = 1;
    			break;
    		}
    	}
    	if (ok){
    		r = mid - 1;
    	}
    	else{
    		l = mid + 1;
    		ans = sum;
    	}
    }
    cout << fixed << setprecision(4) << ans;
    #ifndef ONLINE_JUDGE
       cerr << clock() << " ms";
    #endif
	return 0;
}


#include <bits/stdc++.h>

#define INF 1000000000
#define inf 2147483647
#define MOD 1000000007
#define pf push_front
#define pb push_back
#define ll long long
#define ios ios_base::sync_with_stdio(0)
#define fname ""
#define y1 gg
#define F first
#define S second
#define x1 wp
#define SZ(A) (int((A).size()))
#define deb(x) cerr << " | " << #x << " = " << x
#define ex exit(0)
#define runt assert(0)

using namespace std;

const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

const int drx[] = {2, 2, 1, 1, -1, -1, -2, -2};
const int dry[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int N = 400500;

int n;

double V, mn = INF, a[N], b[N], sum;

int main(){
    #ifndef ONLINE_JUDGE
    freopen(fname".in", "r", stdin);
    freopen(fname".out", "w", stdout);
    #endif

    cin >> n >> V;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i], mn = min(mn, b[i] / a[i]);
    for (int i = 1; i <= n; i++) sum += a[i] * mn;
    cout << fixed << setprecision(4) << min(V, sum);
    #ifndef ONLINE_JUDGE
       cerr << clock() << " ms";
    #endif
	return 0;
}


// Problem : A. Guilty — to the kitchen!
// Contest : Codeforces - Codeforces Beta Round #41
// URL : https://codeforces.com/contest/42/problem/A
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define ios std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mii map<int, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
using namespace std;
const long long MOD=LLONG_MAX; //1e5+7;
int gcd(int x, int y)
{
	if(y==0) return x;
	else return gcd(y,x%y);
}
int power(int x, unsigned int y)
{
    int res = 1;
    x = x % MOD;
    if (x == 0) return 0;

    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % MOD;
        y = y>>1;
        x = (x*x) % MOD;
    }
    return res;
}
void solve()
{
	int n,v,sum=0;
	cin>>n>>v;
	int a[n],b[n];
	long double x=INT_MAX;
	rep(i,0,n){ cin>>a[i]; sum+=a[i];}
	rep(i,0,n){ cin>>b[i]; x=min(x,(long double)(b[i]*1.0)/a[i]);}

	cout<<setprecision(60)<<min(sum*x,(long double)v)<<endl;
}

int32_t main()
{
	ios;
	int t=1;
	//cin>>t;
	while(t--) solve();
}


#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;

int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);

        int n,v;
        cin >> n >> v;
        int i,j;
        int a[n+1],b[n+1];
        for(i=1; i<=n; i++) cin >> a[i];
        for(i=1; i<=n; i++) cin >> b[i];

        double ans=0.00;
        for(double x=1; x<=100; x+=0.5){
            int w=1;
            for(i=1; i<=n; i++){
                if(b[i]>=a[i]*x){
                    continue;
                }
                else{
                    w=0;
                    break;
                }
            }
            if(w==1){
                double s=0;
                for(i=1; i<=n; i++){
                    s=s+a[i]*x;
                }
                if(s<=v)
                {
                    if(ans<s){
                        ans=s;
                    }
                }
            }
        }
        cout << setprecision(16) << fixed << ans << '\n';
}


#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;

int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int n;
        double v;
        cin >> n >> v;
        int i,j;
        int a[n+1],b[n+1];
        for(i=1; i<=n; i++) cin >> a[i];
        for(i=1; i<=n; i++) cin >> b[i];
        double r=10000000.00;
        for(i=1; i<=n; i++){
            double x=(double)(b[i]*1.00)/(double(a[i]*1.00));
            r=min(r,x);
        }
        double s=0.00;
        for(i=1; i<=n; i++){
            s=s+r*a[i];
        }
        if(s>=v){
            cout << setprecision(16) << fixed << v << '\n';
        }
        else{
             cout << setprecision(16) << fixed << s << '\n';
        }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector < double > a, b;
    int n, v;
    cin >> n >> v;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a.push_back(x);
    }
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        b.push_back(x);
    }

    if(n == 1)
    {
        cout << b[0] / a[0] <<endl;
    }

    else
    {

    float low = 100000;
    for(int i = 0; i < n; i++)
    {
         float x = b[i]/a[i];
         if(low > x)
            low = x;
    }
    //cout << low <<endl;
    float ans = 0;
    for(int i = 0; i < n; i++)
    {
         ans += (a[i] * low);
    }

//    double x = min(ans, double(v));// <<endl;

    if(ans > v)
        ans = v;
    cout << ans <<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector < double > a, b;
    int n, v;
    cin >> n >> v;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a.push_back(x);
    }
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        b.push_back(x);
    }

    if(n == 1)
    {
        cout << b[0] <<endl;
    }

    else
    {

    float low = 100000;
    for(int i = 0; i < n; i++)
    {
         float x = b[i]/a[i];
         if(low > x)
            low = x;
    }
    //cout << low <<endl;
    float ans = 0;
    for(int i = 0; i < n; i++)
    {
         ans += (a[i] * low);
    }

//    double x = min(ans, double(v));// <<endl;

    if(ans > v)
        ans = v;
    cout << ans <<endl;
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,r,n) for(int i=r; i<=n; i++)
#define forj(j,n) for(int j=n; j>=0; j--)
#define forx(x,v) for(auto &x:v)
#define sz(v) (int)(v).size()
#define rz(n) resize(n)
#define vec(x) vector < x >
using int64 = long long;
using vi = vector < int >;
using vi64 = vector < int64 >;
using mii = map <int , int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
const int inf = 2e9 + 7;
const char nwl = '\n';
const int mxx = 1e6 + 3;
int64 sumV(vi &v) {
	int64 s = 0;
	for (int x : v) {
		s += (int64)x;
	}
	return s;
}
int gcd(int a, int b) {
	if (!b) return a;
	return gcd(b, a % b);
}
//const int64 biGinf = 9e+18;
//const string yo = "Yes\n", no = "No\n";
using ld = long double;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	int n;
	ld v;
	cin >> n >> v;
	vec(ld) a(n), b(n);
	inpv(a);
	inpv(b);
	ld ans = 0;
	ld ts = 0, s = 0;
	forx(x, a) {
		s += x;
	}
	ts = v / s;
	ld m = v;
	for0(i, n) {
		ld x = b[i] / a[i];
		m = min(x, m);
	}
	m = min(ts, m);
	ans = m * s;
	cout << ans;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    double n, v; cin >> n >>v;
    vector<double> a(n), b(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        cin >> b[i];
    }
    double m = 101;
    for(int i = 0; i < n; i++) {
        m = min(m, b[i]/a[i]);
    }
    m = m * n;
    m = min(m , v);
    cout << m << endl;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    double n, v, sum = 0; cin >> n >>v;
    vector<double> a(n), b(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        cin >> b[i];
    }
    double m = 101;
    for(int i = 0; i < n; i++) {
        m = min(m, b[i]/a[i]);
    }
    for(int i = 0; i < n; i++) {
        sum += (m * a[i]);
    }
    m = min(sum , v);
    cout << m << endl;
}


#include<iostream>
using namespace std;
int main()
{  int n,i;
    double v,x=0,b=101;
 cin>>n>>v;
 pair<double,double> a[n];
 for(i=0;i<n;i++)
 {
     cin>>a[i].first;
     x+=a[i].first;
 }
 for(i=0;i<n;i++)
 {
     cin>>a[i].second;
    if(a[i].second/a[i].first<b)
    b=a[i].second/a[i].first;

 }
 if(b*x<=v)
 {
     cout.precision(4);
     cout<<std::fixed;
     cout<<b*x;
 }
 else
 {
     while(b*x>v)
     {
         b-=0.0001;
     }
     std::cout.precision(4);
     cout<<std::fixed;
     cout<<b*x;
 }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{  int n,i;
    double v,x=0,b=101;
 cin>>n>>v;
 pair<double,double> a[n];
 for(i=0;i<n;i++)
 {
     cin>>a[i].first;
     x+=a[i].first;
 }
 for(i=0;i<n;i++)
 {
     cin>>a[i].second;
    if(a[i].second/a[i].first<b)
    b=a[i].second/a[i].first;

 }
 if(b*x<=v)
 {
     cout.precision(4);
     cout<<std::fixed;
     cout<<b*x;
 }
 else
 {
     while(b*x>v)
     {
         b-=0.00001;
     }
     std::cout.precision(4);
     cout<<std::fixed;
     cout<<b*x;
 }
    return 0;
}