#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int a,b;
int y[200000],z[200000];
int mutu(){
	int l=0,r=1000000000005;
	while(r-l>1){
		int x=(l+r-1)/2,sum=0;
		f(i,a){
			sum+=max((int)(0),y[a-i-1]-x/z[i]);
		}
		if(sum>b)l=x+1;
		else r=x+1;
	}
	return l;
}
signed main(){
	cin>>a>>b;
	f(i,a)cin>>y[i];
	f(i,a)cin>>z[i];
	sort(y,y+a);
	sort(z,z+a);
	cout<<mutu()<<endl;
}
