import std.stdio;
import std.algorithm;
import std.conv;
import std.numeric;
import std.math;
import std.string;

void main()
{
	auto tokens = split(chomp(readln()));
	auto N = to!ulong(tokens[0]);
	auto M = to!ulong(tokens[1]);

	ulong inc = 1;
	if (M % 2 == 1)
	{
		if (N % 2 == 0) ++N;
		inc = 2;
	}
	ulong blocks = M;
	ulong i;
	while (i < M/2 - N + 1)
	{
		if (M % (N + i) == 0)
		{
			blocks = N + i;
			break;
		}
		i += inc;
	}

	writeln(M / blocks);
	stdout.flush();
}