n,m=gets.chomp.split(" ").map{|s| s.to_i}
t={}
for k in 0..n-1
  a,b=gets.chomp.split(" ").map{|s| s.to_i}
  t[a]=b
end
c,s=0,0
Hash[t.sort].each{|k,v|
  for p in 1..v
    break if c==m
    c+=1
    s+=k
  end
}
puts s