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

class Eat
  include Comparable

  def initialize(a, f)
    @a = a; @f = f
  end

  def time
    @a * @f
  end

  def <=>(other)
    self.time <=> other.time
  end

  def train
    @a -= 1
    self
  end
end

class PriorityQueue
  attr_accessor :q
  def initialize
    @q = [nil]
  end

  def bubble_up(i)
    pi = i / 2
    return if i <= 1 || @q[pi] >= @q[i]
    @q[i], @q[pi] = @q[pi], @q[i]
    bubble_up(pi)
  end

  def add(e)
    @q << e
    bubble_up(@q.size - 1)
  end

  def bubble_down(i)
    ci = i * 2
    return if ci > @q.size - 1
    ci += 1 if ci != @q.size - 1 && @q[ci] < @q[ci + 1]
    return if @q[i] >= @q[ci]
    @q[i], @q[ci] = @q[ci], @q[i]
    bubble_down(ci)
  end

  def pop
    @q[1], @q[-1] = @q[-1], @q[1]
    ret = @q.pop
    bubble_down(1)
    ret
  end
end

as, fs = As.sort, Fs.sort.reverse
pq = PriorityQueue.new
as.zip(fs).each{|a, f| pq.add(Eat.new(a, f))}
K.times{pq.add(pq.pop.train)}
puts pq.pop.time