main = do [l, k] <- getLine >>= return . map read . words print $ if l `mod` (2*k) == 0 then k * ( l `div` (2*k) - 1 ) else k * ( l `div` (2*k) )