def bsearch(l,h)
  until h-l<=1
    m=(l+h)/2
    yield(m) ? (h=m) : (l=m)
  end
  h
end
N,K=gets.split.map(&:to_i)
A=gets.split.map(&:to_i).sort.reverse
F=gets.split.map(&:to_i).sort
p bsearch(-1,10**9){|x|A.zip(F).inject(0){|s,(a,f)|s+bsearch(-1,10**9){|i|(a-i)*f<=x}}<=K}