

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



if M % N == 0:

    print((M // N))

else:

    ans = 1

    for n in range(1, M // N + 1):

        res = M - n * N

        if res % n == 0:

            ans = n



    print(ans)



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



divisor = []

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

    if M % i == 0:

        divisor.append(i)

        if i != M // i:

            divisor.append(M // i)



print((max([x for x in divisor if x <= M // N])))

N, M = list(map(int, input().split()))
if M % N == 0:
    print((M // N))
else:
    ans = 1
    for n in range(1, M // N + 1):
        res = M - n * N
        if res % n == 0:
            ans = n
    print(ans)

N, M = list(map(int, input().split()))
divisor = []
for i in range(1, int(M**0.5) + 1):
    if M % i == 0:
        divisor.append(i)
        if i != M // i:
            divisor.append(M // i)
print((max([x for x in divisor if x <= M // N])))

-if M % N == 0: -    print((M // N)) -else: -    ans = 1 -    for n in range(1, M // N + 1): -        res = M - n * N -        if res % n == 0: -            ans = n -    print(ans) +divisor = [] +for i in range(1, int(M**0.5) + 1): +    if M % i == 0: +        divisor.append(i) +        if i != M // i: +            divisor.append(M // i) +print((max([x for x in divisor if x <= M // N])))