import Control.Monad
import Data.List
main = do
  [n,m] <- map read . words <$> getLine
  ab <- replicateM n $ map read . words <$> getLine :: IO[[Int]]
  print $ f (sortOn head ab) 0 m 0

f xs y z p
  | y + last (head xs) < z = f (tail xs) (y + last (head xs)) z (p + product (head xs))
  | y < z && y + last (head xs) >= z = p + (z-y) * head (head xs)
  | otherwise = p
