import Control.Monad main = do [n, k] <- liftM (map read . words) getLine let f x | n `mod` x == 0 = x | otherwise = 1 res = maximum . map f $ [1..(n-1)] in print res