N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i).sort
F = gets.split.map(&:to_i).sort.reverse
AF = A.zip(F).sort_by{|a,b| a * b }
M = AF[-1][0] * AF[-1][1]

ans = (0 .. M).bsearch do |t|
  i = AF.bsearch_index {|ab| ab[0] * ab[1] > t } || N
  k_ = (i ... N).inject(0){|sum, j| sum + AF[j][0] - t / AF[j][1] }
  k_ <= K
end
puts ans