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



if M//N < 10**7:

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

        if M % i ==0:

            break

    print(i)

else:

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

        if M % i == 0:

            break

    else:

        i = M

    print((M//i))
def get_divisor(n):

    a,b = [],[]

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

        if n%i==0:

            a.append(i)

            b.append(n//i)

    if a[-1]==b[-1]:b.pop()

    a.extend(b[::-1])

    return a



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

print((max(n for n in get_divisor(M) if n<=M//N)))
N, M = list(map(int, input().split()))
if M // N < 10**7:
    for i in range(M // N, 0, -1):
        if M % i == 0:
            break
    print(i)
else:
    for i in range(N, int(M**0.5)):
        if M % i == 0:
            break
    else:
        i = M
    print((M // i))

def get_divisor(n):
    a, b = [], []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            a.append(i)
            b.append(n // i)
    if a[-1] == b[-1]:
        b.pop()
    a.extend(b[::-1])
    return a


N, M = list(map(int, input().split()))
print((max(n for n in get_divisor(M) if n <= M // N)))

+def get_divisor(n): +    a, b = [], [] +    for i in range(1, int(n**0.5) + 1): +        if n % i == 0: +            a.append(i) +            b.append(n // i) +    if a[-1] == b[-1]: +        b.pop() +    a.extend(b[::-1]) +    return a + + -if M // N < 10**7: -    for i in range(M // N, 0, -1): -        if M % i == 0: -            break -    print(i) -else: -    for i in range(N, int(M**0.5)): -        if M % i == 0: -            break -    else: -        i = M -    print((M // i)) +print((max(n for n in get_divisor(M) if n <= M // N)))