program partition
  implicit none
  integer(8) :: n, m, i, d
  read(*,*) n, m
  d = m/n
  do i = d, 1, -1
     if (mod(m,i) .eq. 0) then
        write(*,'(i0)') i
        stop
     end if
  end do
end program partition