import math

N, M = list(map(int,input().split()))



P = []

for k in range(1,math.floor(math.sqrt(M))+1):

    if M % k == 0:

        P.append(k)

        P.append(M//k)

ans = 1

for e in P:

    if e*N <= M:

        ans = max(ans,e)

print(ans)

import math

N, M = list(map(int,input().split()))

b = 0



P = [1]

for k in range(2,math.floor(math.sqrt(M))+1):

    if M % k == 0:

        P.append(k)

        P.append(M//k)



P = sorted(P)

for e in P:

    if e >= N:

        print((M//e))

        exit(0)

print((1))

import math

N, M = list(map(int, input().split()))
P = []
for k in range(1, math.floor(math.sqrt(M)) + 1):
    if M % k == 0:
        P.append(k)
        P.append(M // k)
ans = 1
for e in P:
    if e * N <= M:
        ans = max(ans, e)
print(ans)

import math

N, M = list(map(int, input().split()))
b = 0
P = [1]
for k in range(2, math.floor(math.sqrt(M)) + 1):
    if M % k == 0:
        P.append(k)
        P.append(M // k)
P = sorted(P)
for e in P:
    if e >= N:
        print((M // e))
        exit(0)
print((1))

-P = [] -for k in range(1, math.floor(math.sqrt(M)) + 1): +b = 0 +P = [1] +for k in range(2, math.floor(math.sqrt(M)) + 1): -ans = 1 +P = sorted(P) -    if e * N <= M: -        ans = max(ans, e) -print(ans) +    if e >= N: +        print((M // e)) +        exit(0) +print((1))