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

i = 1

lis = []

while M//i>=N and i<=M**0.5:

  if M % i == 0:

    lis.append(i)

  i += 1

for l in lis[::-1]:

  ans = M//l

  if M//ans>=N:

    lis.append(ans)

print((lis[-1]))
def divisor(n):

  cd = []

  i = 1

  while i*i <= n:

    if n%i==0:

      cd.append(i)

      if i != n//i:

        cd.append(n//i)

    i += 1

  return cd



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

cd = divisor(M)

cd.sort(reverse=True)

for c in cd:

  if M//c>=N:

    print(c)

    break
N, M = list(map(int, input().split()))
i = 1
lis = []
while M // i >= N and i <= M**0.5:
    if M % i == 0:
        lis.append(i)
    i += 1
for l in lis[::-1]:
    ans = M // l
    if M // ans >= N:
        lis.append(ans)
print((lis[-1]))

def divisor(n):
    cd = []
    i = 1
    while i * i <= n:
        if n % i == 0:
            cd.append(i)
            if i != n // i:
                cd.append(n // i)
        i += 1
    return cd


N, M = list(map(int, input().split()))
cd = divisor(M)
cd.sort(reverse=True)
for c in cd:
    if M // c >= N:
        print(c)
        break

+def divisor(n): +    cd = [] +    i = 1 +    while i * i <= n: +        if n % i == 0: +            cd.append(i) +            if i != n // i: +                cd.append(n // i) +        i += 1 +    return cd + + -i = 1 -lis = [] -while M // i >= N and i <= M**0.5: -    if M % i == 0: -        lis.append(i) -    i += 1 -for l in lis[::-1]: -    ans = M // l -    if M // ans >= N: -        lis.append(ans) -print((lis[-1])) +cd = divisor(M) +cd.sort(reverse=True) +for c in cd: +    if M // c >= N: +        print(c) +        break