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

x = M//N

max = 1

for i in range(x, 0, -1):

    mod = M - (N-1)*i

    if mod%i == 0:

        max = i

        break

print(max)
import math

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

ulim = M//N

mid = int(math.sqrt(M))

if ulim >= mid:

    ans = []

    for i in range(1, mid+1):

        if M%i == 0:

            ans.append(i)

            if M//i <= ulim:

                ans.append(M//i)

    print((max(ans)))

 

else:

    for i in reversed(list(range(1, ulim+1))):

        if M%i == 0:

            print(i)

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

import math

N, M = list(map(int, input().split()))
ulim = M // N
mid = int(math.sqrt(M))
if ulim >= mid:
    ans = []
    for i in range(1, mid + 1):
        if M % i == 0:
            ans.append(i)
            if M // i <= ulim:
                ans.append(M // i)
    print((max(ans)))
else:
    for i in reversed(list(range(1, ulim + 1))):
        if M % i == 0:
            print(i)
            break

+import math + -x = M // N -max = 1 -for i in range(x, 0, -1): -    mod = M - (N - 1) * i -    if mod % i == 0: -        max = i -        break -print(max) +ulim = M // N +mid = int(math.sqrt(M)) +if ulim >= mid: +    ans = [] +    for i in range(1, mid + 1): +        if M % i == 0: +            ans.append(i) +            if M // i <= ulim: +                ans.append(M // i) +    print((max(ans))) +else: +    for i in reversed(list(range(1, ulim + 1))): +        if M % i == 0: +            print(i) +            break