import Control.Applicative
import Control.Monad
import Data.List

factors n = fsub n (2:[3,5..])
  where
    fsub 1 _ = []
    fsub k pa@(p:ps)
      | r==0 = p : fsub q pa
      | k < p*p = [k]
      | otherwise = fsub k ps
      where
        (q, r) = divMod k p

divisors = dsub . group . factors
  where
    dsub [] = [1]
    dsub (d:ds) = (*) <$> (1:(zipWith (flip (^)) [1..] d)) <*> dsub ds

f [n, m] = div m $ minimum $ filter (>=n) $ divisors m

main = map read . words <$> getLine >>= print . f