import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [b, c] <- map strToInt . words <$> getLine
    if b `mod` c == 0 then putStrLn "1"
        else putStrLn . show $ head [b * i | i <- [1..], b*i `mod` c /= 0]
