#include <stdio.h> struct STUFF { double ku,price; double dan; }; int main() { int N,D; float income=0; struct STUFF stuff[1001]; scanf("%d %d",&N,&D); int left=D; for(int i=0;i<N;i++) scanf("%lf",&stuff[i].ku); for(int i=0;i<N;i++) { scanf("%lf",&stuff[i].price); stuff[i].dan=stuff[i].price/stuff[i].ku; } struct STUFF tmp; for(int i=0;i<N-1;i++) { for(int j=0;j<N-1-i;j++) { if(stuff[j].dan<stuff[j+1].dan) { tmp=stuff[j]; stuff[j]=stuff[j+1]; stuff[j+1]=tmp; } } } for(int i=0;i<N;i++) { if(stuff[i].ku<left) { left-=stuff[i].ku; income+=stuff[i].price; } else if(stuff[i].ku==left) { income+=stuff[i].price; break; } else { income+=stuff[i].dan*left; break; } } printf("%.2f",income); return 0; }