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

if N==1:

    nmax=M

else:

    nmax = 1

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

        if M%i==0 and M//i>=N:

            nmax = max(nmax,i)

        if M%i==0 and i>=N:

            nmax = max(nmax,M//i)

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

amax = 1

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

    if M%i==0:

        a = i

        b = M//i

        if b>=N:

            amax = max(amax,a)

        a,b = b,a

        if b>=N:

            amax = max(amax,a)

print(amax)
N, M = list(map(int, input().split()))
if N == 1:
    nmax = M
else:
    nmax = 1
    for i in range(2, int(M**0.5) + 1):
        if M % i == 0 and M // i >= N:
            nmax = max(nmax, i)
        if M % i == 0 and i >= N:
            nmax = max(nmax, M // i)
print(nmax)

N, M = list(map(int, input().split()))
amax = 1
for i in range(1, int(M**0.5) + 1):
    if M % i == 0:
        a = i
        b = M // i
        if b >= N:
            amax = max(amax, a)
        a, b = b, a
        if b >= N:
            amax = max(amax, a)
print(amax)

-if N == 1: -    nmax = M -else: -    nmax = 1 -    for i in range(2, int(M**0.5) + 1): -        if M % i == 0 and M // i >= N: -            nmax = max(nmax, i) -        if M % i == 0 and i >= N: -            nmax = max(nmax, M // i) -print(nmax) +amax = 1 +for i in range(1, int(M**0.5) + 1): +    if M % i == 0: +        a = i +        b = M // i +        if b >= N: +            amax = max(amax, a) +        a, b = b, a +        if b >= N: +            amax = max(amax, a) +print(amax)