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 blocks = M;
	foreach (i; 0..M/2 - N + 1)
	{
		if (M % (N + i) == 0)
		{
			blocks = N + i;
			break;
		}
	}

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