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



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	return tuple( nm[ 0 ], nm[ 1 ] );
}

auto solve( long n, long m )
{
	for( auto i = m / n; 0 < i; i-- )
	{
		if( m % i == 0 ) return i;
	}
	assert( false );
}
