import Data.Heap

parsePair :: IO (Int, Int)
parsePair = do
    [a,b] <- (map read . words) <$> getLine :: IO [Int]
    return (a,b)

main = do
    (n,m) <- parsePair
    pairList <- sequence $ replicate n parsePair :: IO [(Int,Int)]
    let heap = empty :: Heap FstMinPolicy (Int, Int)
    let nHeap = foldr insert heap pairList
    case solve m 0 nHeap of
        Just x -> print x


solve :: Int -> Int -> Heap FstMinPolicy (Int, Int) -> Maybe Int
solve rest ac heap = do
    case viewHead heap of
        Just (p,n) -> do
            if n >= rest
                then Just (ac + p*rest)
                else do
                    tl <- viewTail heap
                    solve (rest - n) (ac + p*n) tl