#include <iostream>
#include <cstdio>
#include <algorithm>
#define maxn 100005
using namespace std;
int n,k;
double a[maxn],b[maxn],c[maxn];
bool judge(double x)
{
for(int i=1;i<=n;++i) c[i]=a[i]-x*b[i];
sort(c+1,c+n+1);
double sum=0;
for(int i=n-k+1;i<=n;++i) sum+=c[i];
return (sum>0);
}
int main()
{
scanf("%d%d",&n,&k);
for(int i=1;i<=n;++i) scanf("%lf",&a[i]);
for(int i=1;i<=n;++i) scanf("%lf",&b[i]);
double r=1,l=0;
while(r-l>1e-6)
{
double mid=(r+l)/2.0;
if(judge(mid)) l=mid;
else r=mid;
}
printf("%.4f
",l);
return 0;
}