open System

let nm = stdin.ReadLine().Split() |> Array.map int
let n = nm.[0]
let m = nm.[1]

let mutable ans = 1
let sqrt = Math.Sqrt(m |> float) |> int
for d in [1..sqrt] do
    if (m % d = 0) && (d * n <= m) then
        ans <- Math.Max(ans, d)
    if (m % d= 0) && ((m / d) * n <= m) then
        ans <- Math.Max(ans, (m / d))

printfn "%d" ans
