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

for i in range(M // N, 0, -1):

    if M % i == 0:

        print(i)

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

lim = M // N

ans = 0

for i in range(1, int(M ** (1/2)) + 1):

    if M % i == 0:

        if ans < i <= lim:

            ans = i

        if ans < M // i <= lim:

            ans = M // i

print(ans)
N, M = list(map(int, input().split()))
for i in range(M // N, 0, -1):
    if M % i == 0:
        print(i)
        break

N, M = list(map(int, input().split()))
lim = M // N
ans = 0
for i in range(1, int(M ** (1 / 2)) + 1):
    if M % i == 0:
        if ans < i <= lim:
            ans = i
        if ans < M // i <= lim:
            ans = M // i
print(ans)

-for i in range(M // N, 0, -1): +lim = M // N +ans = 0 +for i in range(1, int(M ** (1 / 2)) + 1): -        print(i) -        break +        if ans < i <= lim: +            ans = i +        if ans < M // i <= lim: +            ans = M // i +print(ans)