program abc112_d
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,m
    integer(int32):: i

    read*, n,m
    do i=m/n,1,-1
        if (mod(m,i) == 0) then
            print'(i0)', i
            stop
        end if
    end do
end program abc112_d