(N, K), As, Fs = readlines.map{|l| l.split.map(&:to_i)}

afps = As.sort.zip(Fs.sort.reverse).map{|a, f| [a, f, a*f]}
puts (0 .. 10**12).bsearch {|x| afps.select{|_, _, p| p > x}.inject(0){|s, (a, f, _)| s + a - x/f} <= K}