```
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
typedef long double ld;
const int N=1010;
struct P{
ld a,b,c;
}st[N];
bool cmp(P a,P b){
return a.c>b.c;
}
int main(){
int n,m;
cin>>n>>m;
m=1000;
ld x;
for(int i=0;i<n;i++){
scanf(“%Lf”,&x);
st[i].a=x1000;
}
for(int i=0;i<n;i++){
scanf("%Lf",&x);
st[i].b=x*1000;
}
for(int i=0;i<n;i++){
ld temp=st[i].b/st[i].a;
st[i].c=temp;
}
sort(st,st+n,cmp);
ld sum=0;
int k=0;
while(m>0&&k[HTML_REMOVED]=st[k].a)
sum+=st[k].b,m-=st[k].a,k++;
else
sum+=m*st[k].c,m-=m;
}
printf(“%.2Lf”,sum/1000+1e-18);
return 0;
}`
````