N,K=gets.split.map(&:to_i)
A=gets.split.map(&:to_i).sort.reverse
F=gets.split.map(&:to_i).sort
P=A.zip(F)

l,h=-1,10**18+1
until h-l==1
  m=(l+h)/2
  if P.inject(0){|s,(a,f)|s+[0, a-m/f].max} <= K
    h = m
  else
    l = m
  end
end
p h