# O(n * log(n)) で解く

def g(i, n, t) $a_sums[i] + h(i+1, n, t) end    # O(n)
def h(i, n, t) (i..n).inject(0) do |s,j| s + t / $fs[j] end end    # O(n)
def afs(i) $as[i] * $fs[i] end    # O(1)
def nlr(n, l, i) [n - i, l - $a_sums[i], $rs[i+1]] end    # O(1)

n, k = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)
fs = gets.split.map(&:to_i)
 
l = as.sum - k

if (l <= 0)
  p 0
  exit
end

# O(n * log(n))
as.sort!
fs.sort_by! {|f| -f}

max_f = fs[0]

# O(n * log(n))
$as, $fs = as.zip(fs).push([0,1]).sort_by do |a,f| a*f end.transpose

a_acc = 0
# O(n)
$a_sums = $as.map do |a| a_acc += a end

max_af = $as[n] * $fs[n]
q = max_f + max_af
$rs = []
# O(n)
n.downto(1).inject(0) do |r,i| $rs[i] = r + q / $fs[i] end

lb = ub = nil
ilb = nil

# O(n + log(n))
m = (0..n).bsearch do |i|
  next false if (i == 0)
  next true if (i == n)

  af = afs(i)
  nn, ll, r = nlr(n, l, i)

  next false if (af * (r + nn) / q < ll)
  next true if ((af * r + q - 1) / q - nn >= ll)

  next false if (lb)
  next true if (ub)

  # O(n)
  if (h(i+1, n, af) < ll)
    lb, ilb = af, i
    next false
  else
    ub = af
    next true
  end
end

# O(n)
if (lb)
  af = afs(m-1)
  ub = af if (g(m-1, n, af) > l)
elsif (ub)
  af = afs(m)
  lb, ilb = af, m if (g(m, n, af) < l)
end

# O(1)
unless (lb && ub)
  ilb = m-1

  nn, ll, r = nlr(n, l, m-1)

  af = afs(m)
  ub = [ub || max_af, (ll + nn) * q / r, af].min

  rr = r + nn
  af = afs(m-1)
  lb = [lb || 0, (ll * q + rr - 1)/ rr, af].max
end

xs = []
# O(n)
# push の回数は 3 * n を超えないはず
(ilb..n).each do |i|
  f = $fs[i]
  af = afs(i)
  t = [ub - ub % f, af].min
  t.step(lb, -f) do |x| xs.push(x) end
end

k = xs.length

raise if (k > 3 * n)

kk = g(ilb, n, ub) - l

# O(n) のアルゴリズムもあるがこの問題のサイズでは組み込みの sort を使った方が速いようだ
# O(n * log(n))
p xs.sort[k - 1 - kk]