#coding: euc-jp
class Main
  def self.main
    n, m = Func.read1
    a, b = Func.read2(n)
    a, b = [a, b].mysort
    count = 0
    shop = 0
    price = 0
    while count < m
      if m - count > b[shop] then
        price += a[shop] * b[shop]
        count += b[shop]
      else
        price += a[shop] * (m - count)
        count += (m - count)
      end
      shop += 1
    end
    Func.write(price)
  end
end

module Function
  def read1
    return gets.chomp.split.map(&:to_i)
  end
  def read2(t)
    return t.times.map{gets.chomp.split.map(&:to_i)}.transpose
  end
  def write(ins)
    puts ins
  end
end

module Conv
  def mysort
    return self.transpose.sort{|a, b| a[0] <=> b[0]}.transpose
  end
end

class Func
  extend Function
end

class Array
  include Conv
end

Main.main
