local function gen_divisor(n)
    return coroutine.wrap(function()
        local ds = {}
        for i=1, math.floor(n^0.5) do
            if n % i == 0 then
                coroutine.yield(i)
                table.insert(ds, n // i)
            end
        end
        if n // ds[#ds] == ds[#ds] then
            table.remove(ds)
        end
        for i=#ds,1,-1 do
            coroutine.yield(ds[i])
        end
    end)
end

local N, M = io.read("n", "n")
for di in gen_divisor(M) do
    if di >= N then
        ans = M // di
        print(ans)
        return
    end
end