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

ans = (0 .. F.first * A.last).bsearch do |t|
  k = N.times.inject(0) do |s, i|
    a = A[i]
    b = F[i]
    if a * b <= t
      s
    else
      k_ = a - t / b
      s + k_
    end
  end
  k <= K
end
puts ans
