module Main where

import qualified Data.Vector                   as V
import           Data.List
import           Control.Applicative
import           Control.Monad


main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  ns     <-
    fmap (sortBy (\(a : _) (b : _) -> compare a b))
    .   replicateM n
    $   map read
    .   words
    <$> getLine

  let hmany =
        n - length (filter (\i -> sum i >= m) $ inits $ map (!! 1) ns) + 1

  print $ f1 (take hmany ns) 0 0 m

f1 []       _   mny _ = mny
f1 [n     ] cnt mny m = mny + (m - cnt) * head n
f1 (n : ns) cnt mny m = f1 ns (cnt + last n) (mny + last n * head n) m
