import Data.List
import qualified Data.IntMap as M

primes::[Int]
primes=2:3:p where 
    p=5:q 1 7 p
    q m s (p:ps)=[n|n<-[x+y|x<-[s,s+6..p*p-2],y<-[0,4]],gcd m(toInteger n)<2]++q(m*toInteger p)(p*p)ps

fac :: [Int]->M.IntMap Int->Int->M.IntMap Int
fac _ m 1=m
fac [] m p=M.insertWith(+)p 1 m
fac pa@(p:pr) m n
    |mod n p==0=fac pa(M.insertWith(+) p 1 m)(div n p)
    |otherwise =fac pr m n

facs fs=map(foldl'(\a (p,n)->a*p^n)1.zip ps)$mapM(enumFromTo 0)ns
    where (ps,ns)=unzip fs

facsn = facs.M.toList.fac(takeWhile(<31623)primes)M.empty

main = do
    (n:m:_)<-map read.words<$>getLine::IO[Int]
    print $ solve n m

solve n m = m `div` a
    where
        a = head $ dropWhile (<n) $ sort $ facsn m