require "matrix"

n, $k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
f = gets.split.map(&:to_i)
a.sort!
f.sort!.reverse!
$cost = Matrix.build(n, 3) do |row, col|
  case col
  when 0
    a[row]
  when 1
    f[row]
  when 2
    a[row] * f[row]
  end
end


def check(x) # x以下のコストにできるか
  cnt = 0
  $cost.row_vectors.each do |c|
    if c[2] > x
      cnt += (c[0] - x / c[1])
    end
  end
  cnt <= $k
end

ok = 10 ** 18
ng = -1
while (ok - ng).abs > 1
  mid = (ok + ng) / 2
  if check(mid)
    ok = mid
  else
    ng = mid
  end
end
p ok
