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

x=1

if m%n==0:

    print((m//n))

else:

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

        if m%i==0 and i*n<=m:

            x=max(x,i)

        if m%i==0 and (m//i)*n<=m:

            x=max(x,m//i)

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

x=1

if m%n==0:

    print((m//n))

else:

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

        if m%i==0 and i*n<=m:

            x=max(x,i)

        if m%(m//i)==0 and (m//i)*n<=m:

            x=max(x,m//i)

    print(x)
n, m = list(map(int, input().split()))
x = 1
if m % n == 0:
    print((m // n))
else:
    for i in range(1, m // n + 1):
        if m % i == 0 and i * n <= m:
            x = max(x, i)
        if m % i == 0 and (m // i) * n <= m:
            x = max(x, m // i)
    print(x)

n, m = list(map(int, input().split()))
x = 1
if m % n == 0:
    print((m // n))
else:
    for i in range(1, int(m**0.5) + 1):
        if m % i == 0 and i * n <= m:
            x = max(x, i)
        if m % (m // i) == 0 and (m // i) * n <= m:
            x = max(x, m // i)
    print(x)

-    for i in range(1, m // n + 1): +    for i in range(1, int(m**0.5) + 1): -        if m % i == 0 and (m // i) * n <= m: +        if m % (m // i) == 0 and (m // i) * n <= m: