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

qsort [] = []
qsort (p:xs) = qsort smaller ++ [p] ++ qsort larger
    where smaller = [x | x <- xs, head x < head p ]
          larger  = [x | x <- xs, head x >= head p]
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