import Data.List (sort)

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine :: IO [Integer]
  abs <- sequence . replicate (fromInteger n) $ unsafeListToTuple . map read . words <$> getLine :: IO [(Integer, Integer)]
  let
    abs' = sort abs
    a = fst . foldl step (0, 0) $ abs'
    step (s, t) (u, v) = if t + v < m then (s + u * v, t + v) else let v' = m - t in (s + u * v', m)
  print a

unsafeListToTuple :: [a] -> (a, a)
unsafeListToTuple (x : y : _) = (x, y)
unsafeListToTuple _ = undefined
