import Foundation

extension String {
    func split(separator: String) -> [Int] {
        return self.componentsSeparatedByString(separator).map { Int($0)! }
    }
}

let input = readLine()!.split(" ")
let N = input[0]
let M = input[1]

var AB = [[Int]]()
for _ in 0..<N {
    let input = readLine()!.split(" ")
    AB.append([input[0], input[1]])
}
AB.sortInPlace{$0[0] < $1[0]}

var ans = 0
var i = 0
var j = 0
for _ in 0..<M {
    if i+1 > AB[j][1] {
        j += 1
      	i = 0
    }
    ans += AB[j][0]
  	i += 1
}

print(ans)