N,K = gets.split.map &:to_i
A = gets.split.map(&:to_i).sort.reverse
F = gets.split.map(&:to_i).sort
MaxT = A.max * F.max
p (0..MaxT).bsearch{ |t|
  k = (0...N).reduce(0){ |s,i|
    a = t / F[i]
    s + [A[i] - a, 0].max
  }
  k <= K
}

