import Control.Monad
import Data.List

type Pair = (Int, Int)

main :: IO ()
main = do
  [n,m] <- map read . words <$> getLine
  abs <- replicateM n readPair
  print $ f m $ sortOn fst abs

f :: Int -> [Pair] -> Int
f m = fst . foldl' f e
  where
    e = (0,0)
    f (s,n) (a,b)
      | n == m = (s,n)
      | n+b > m = until ((b==).snd) (\(a,b) -> (s+a,b+1)) (a,b)
      | n+b < m = (s+a*b, n+b)
      | otherwise = error ":("

readPair :: IO Pair
readPair = do
  [x,y] <- map read . words <$> getLine
  return (x,y)