n, m = list(map(int, input().split()))

 

for i in range(m//n, 0, -1):

    if m % i != 0:

        continue

    print(i)

    break
from math import sqrt, ceil

n, m = list(map(int, input().split()))



M = set()

for i in range(1, ceil(sqrt(m))+1):

    if m % i == 0:

        M.add(i)

        M.add(m//i)

M = sorted(list(M), reverse=True)

#print(M)

for i in M:

    if i <= m // n:

        print(i)

        break

n, m = list(map(int, input().split()))
for i in range(m // n, 0, -1):
    if m % i != 0:
        continue
    print(i)
    break

from math import sqrt, ceil

n, m = list(map(int, input().split()))
M = set()
for i in range(1, ceil(sqrt(m)) + 1):
    if m % i == 0:
        M.add(i)
        M.add(m // i)
M = sorted(list(M), reverse=True)
# print(M)
for i in M:
    if i <= m // n:
        print(i)
        break

+from math import sqrt, ceil + -for i in range(m // n, 0, -1): -    if m % i != 0: -        continue -    print(i) -    break +M = set() +for i in range(1, ceil(sqrt(m)) + 1): +    if m % i == 0: +        M.add(i) +        M.add(m // i) +M = sorted(list(M), reverse=True) +# print(M) +for i in M: +    if i <= m // n: +        print(i) +        break