local n = io.read("n")
local m = io.read("n")
local mm = math.ceil(m ^ 0.5)
local max = 0
for i = 1, mm do
	if m % i == 0 then
		local a = i
		local b = m // a
		if b >= n then
			max = math.max(a, max)
		end
		if a >= n then
			max = math.max(b, max)
		end
	end
end
print(max)
