unittest
{
	assert( [ "3 14" ].solve == 2 );
	assert( [ "10 123" ].solve == 3 );
	assert( [ "100000 1000000000" ].solve == 10000 );
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto m = 0L;
	input.front.formattedRead!"%s %s"( n, m );
	
	foreach( d; m.divisors.sort!( ( a, b ) => b < a ) )
	{
		if( n <= m / d ) return d;
	}
	return 1L;
}

// 約数列挙
auto divisors( long n )
{
	bool[ long ] ds;
	auto s = cast( long ) n ^^ 0.5L;
	for( auto i = 1L; i <= s; i++ )
	{
		if( n % i != 0 ) continue;
		ds[ i     ] = true;
		ds[ n / i ] = true;
	}
	return ds.keys;
}
