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

for i in range(2,m):

  if i*i>m:

    print((1))

    exit()

  if m%i==0:

    break

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

  if m%i==0:

    print((m//i))

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

stack=[]

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

  if m%i==0:

    if i<=m//n:

      stack.append(i)

    if m//i<=m//n:

      stack.append(m//i)

print((max(stack)))
n, m = list(map(int, input().split()))
for i in range(2, m):
    if i * i > m:
        print((1))
        exit()
    if m % i == 0:
        break
for i in range(n, m + 1):
    if m % i == 0:
        print((m // i))
        exit()

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

-for i in range(2, m): -    if i * i > m: -        print((1)) -        exit() +stack = [] +for i in range(1, int(m**0.5) + 1): -        break -for i in range(n, m + 1): -    if m % i == 0: -        print((m // i)) -        exit() +        if i <= m // n: +            stack.append(i) +        if m // i <= m // n: +            stack.append(m // i) +print((max(stack)))