n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort.reverse
f = gets.split.map(&:to_i).sort
x = []
(0..n-1).each{|i| x[i] = a[i] * f[i]}
ary = a.zip(f, x).sort{|a, b|a[2] <=> b[2]}.reverse
while k > 0 do
  i = 0
  if ary[i][0] > 0
    ary[0][0] -= 1
    ary[0][2] = ary[0][0] * ary[0][1]
    ary = ary.sort{|a, b|a[2] <=> b[2]}.reverse
    k -= 1
  else
    break
  end
end
puts ary[0][2]

