def b_search (min, max)
  mid = (min + max) / 2
  if mid == min
    if possible?(min)
      return min
    else
      return max
    end
  end
  unless possible?(mid)
    min = mid
  else
    max = mid
  end
  b_search(min, max)
end

def possible?(limit)
  possible_costs = $food_costs.map { |fc| limit / fc }
  neccesary_training = 0
  N.times do |i|
    tmp_cost = $eat_costs[i] - possible_costs[i]
    neccesary_training += tmp_cost if tmp_cost > 0
    return false if neccesary_training > K
  end
  neccesary_training <= K
end

INF = 10 ** 18
N, K = gets.split.map(&:to_i)
$eat_costs = gets.split.map(&:to_i).sort
$food_costs = gets.split.map(&:to_i).sort { |a, b| b <=> a }

puts b_search(0, INF)
