n, m = list(map(int, input().split()))



lstDiv = []

k = 1

while k * k <= m:

    div, r = divmod(m, k)

    if r == 0:

        lstDiv.append(k)

        lstDiv.append(div)

    k += 1



lstDiv = sorted(lstDiv, reverse=True)



for div in lstDiv:

    if div * n <= m:

        print(div)

        break
from bisect import bisect_left



n, m = list(map(int, input().split()))



st = set()

i = 1

while i * i <= m:

    if m % i == 0:

        st.add(i)

        st.add(m // i)

    i += 1



divs = tuple(sorted(st))

i = bisect_left(divs, n)

print((m // divs[i]))

n, m = list(map(int, input().split()))
lstDiv = []
k = 1
while k * k <= m:
    div, r = divmod(m, k)
    if r == 0:
        lstDiv.append(k)
        lstDiv.append(div)
    k += 1
lstDiv = sorted(lstDiv, reverse=True)
for div in lstDiv:
    if div * n <= m:
        print(div)
        break

from bisect import bisect_left

n, m = list(map(int, input().split()))
st = set()
i = 1
while i * i <= m:
    if m % i == 0:
        st.add(i)
        st.add(m // i)
    i += 1
divs = tuple(sorted(st))
i = bisect_left(divs, n)
print((m // divs[i]))

+from bisect import bisect_left + -lstDiv = [] -k = 1 -while k * k <= m: -    div, r = divmod(m, k) -    if r == 0: -        lstDiv.append(k) -        lstDiv.append(div) -    k += 1 -lstDiv = sorted(lstDiv, reverse=True) -for div in lstDiv: -    if div * n <= m: -        print(div) -        break +st = set() +i = 1 +while i * i <= m: +    if m % i == 0: +        st.add(i) +        st.add(m // i) +    i += 1 +divs = tuple(sorted(st)) +i = bisect_left(divs, n) +print((m // divs[i]))