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

-- solve :: Int -> Int -> Int
-- solve n m | m `mod` n == 0 = m `div` n
--           | otherwise = solve (n+1) 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 <- [2..], n `mod` x == 0]
