n, k = $stdin.readline.chomp.split.map(&:to_i)
a = $stdin.readline.chomp.split.map(&:to_i).sort
f = $stdin.readline.chomp.split.map(&:to_i).sort.reverse

c = a.zip(f).sort_by! {|x, y| [x * y, y] }

# 成績をx以下にするために必要な最小の修行回数
res = (0..10 ** 18).bsearch {|x|
  cnt = 0
  i = c.bsearch_index {|y, z| y * z > x } || n
  while i < n
    cnt += ((c[i].inject(:*) - x) + c[i][1] - 1) / c[i][1]
    i += 1
  end
  cnt <= k
}
puts res