import math



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



def divisors(M):

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

        if M % d == 0:

            yield d

            yield M // d



d = max(d for d in divisors(M) if d <= M // N)

print(d)
import math



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



sqrtM = math.floor(math.sqrt(M))

maxd  = min(sqrtM, M // N)



d1 = max(      d for d in range(1, maxd  + 1) if M % d == 0)

d2 = max((M // d for d in range(N, sqrtM + 1) if M % d == 0), default=1)

print((max(d1, d2)))

import math

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


def divisors(M):
    for d in range(1, math.floor(math.sqrt(M)) + 1):
        if M % d == 0:
            yield d
            yield M // d


d = max(d for d in divisors(M) if d <= M // N)
print(d)

import math

N, M = list(map(int, input().split()))
sqrtM = math.floor(math.sqrt(M))
maxd = min(sqrtM, M // N)
d1 = max(d for d in range(1, maxd + 1) if M % d == 0)
d2 = max((M // d for d in range(N, sqrtM + 1) if M % d == 0), default=1)
print((max(d1, d2)))

- - -def divisors(M): -    for d in range(1, math.floor(math.sqrt(M)) + 1): -        if M % d == 0: -            yield d -            yield M // d - - -d = max(d for d in divisors(M) if d <= M // N) -print(d) +sqrtM = math.floor(math.sqrt(M)) +maxd = min(sqrtM, M // N) +d1 = max(d for d in range(1, maxd + 1) if M % d == 0) +d2 = max((M // d for d in range(N, sqrtM + 1) if M % d == 0), default=1) +print((max(d1, d2)))