input = gets.chomp.split(" ").map(&:to_i)
N = input[0]
K = input[1]

people = gets.chomp.split(" ").map(&:to_i).sort
foods = gets.chomp.split(" ").map(&:to_i).sort.reverse
products = []
people.each_with_index do |e,i|
  products << e*foods[i]
end

maximum = products.max
minimum = 0

# 二分探索
while minimum + 1 < maximum do
  count = 0
  center_value = (minimum + maximum)/2
  foods.each_with_index do |food,i|
    count += ( ( products[i] - center_value ) / food.to_f ).ceil
  end
  if count <= K
    maximum = center_value
  else
    minimum = center_value
  end
end


puts maximum
