import Data.List

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

solve :: Int -> Int -> Int
solve n m = m `div` y
  where y = head $ filter (>=n) $ factors m

factors :: Int -> [Int]
factors n = [x | x <- primes n, n `mod` x == 0]

primes :: Int -> [Int]
primes n = 2 : eratos [3,5 .. n]
  where
    eratos [] = []
    eratos (p:xs) = p : eratos (xs \\ [p,3*p..n])
