import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto data = readln.split;
	auto N = data[0].to!int, M = data[1].to!int;
	auto D = M / N;
	if (D == 1) { writeln(1); return; }
	foreach_reverse (i; 1 .. D+1) {
		if (M%i == 0) { writeln(i); return; }
	}
}