N,K= gets.split.map(&:to_i)
A = gets.split.map(&:to_i).sort
F = gets.split.map(&:to_i).sort.reverse
max_time = A.map.with_index{|a,i| a * F[i]}.max

puts (0...max_time).bsearch{|x|
  k = K
  N.times do |i|
    diff = A[i] * F[i] - x
    next if diff <= 0
    k -= (diff.to_f / F[i]).ceil
    break if k < 0
  end
  k >= 0
}