lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]
K = lines[0][1]
a = (lines[1]).sort
f = (lines[2]).sort.reverse

score_now = 0
for i in 1..N do
  if a[i-1] * f[i-1] > score_now then
    score_now = a[i-1] * f[i-1]
  end
end

found = false
twice = false
obj_max = score_now
obj_min = 0
objective = score_now / 2
while found == false do
  num_train = 0
  for i in 1..N do
    if f[i-1] * a[i-1] > objective then
      num_train += a[i-1] - objective / f[i-1]
    end
  end
  if num_train > K then  #failure
    obj_min = objective
    objective = (objective + obj_max) / 2
  else  #success
    obj_max = objective
    objective = (obj_min + objective) / 2
  end
  if obj_max == 0 then
    ans = 0
    found = true
  elsif obj_max == obj_min + 1 then
    if twice then
      ans = obj_max
      found = true
    else
      twice = true
    end
  end
end
    
print ans