program main
implicit None
	integer(8)::n,m,a,i,k
	integer(8),allocatable::d(:)
	
	read *,n,m
	
	a = m/n
	allocate(d(a))
	
	k = 1
	
	do i = 1,a
		if(mod(m,i) == 0)then
			d(k) = i
			k = k+1
		endif
	enddo
	
	if(k /= 1)then
		k = k-1
	endif
	
	print 102,d(k)

101 format(a)
102 format(i0)
end program main