import math as m

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

# N == 1 の処理

if N == 1:

    print(M)

    exit()

# Mの素数判定

judge = "prime"

for i in range(m.floor(pow(M,1/2)),1,-1):

    if M % i == 0:

        judge = "conposite"

        break

if judge == "prime":

    print((1))

    exit()

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

    if M % i == 0:

        print(i)

        exit()
import math as m

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

divisor = []

for i in range(1,m.floor(pow(M,1/2)) + 1):

  if M % i == 0:

    divisor.append(i)

    divisor.append(M // i)

ans = 1

for e in divisor:

  if e > ans and e <= M // N:

    ans = e

print(ans)
import math as m

N, M = list(map(int, input().split()))
# N == 1 の処理
if N == 1:
    print(M)
    exit()
# Mの素数判定
judge = "prime"
for i in range(m.floor(pow(M, 1 / 2)), 1, -1):
    if M % i == 0:
        judge = "conposite"
        break
if judge == "prime":
    print((1))
    exit()
for i in range(M // N, 0, -1):
    if M % i == 0:
        print(i)
        exit()

import math as m

N, M = list(map(int, input().split()))
divisor = []
for i in range(1, m.floor(pow(M, 1 / 2)) + 1):
    if M % i == 0:
        divisor.append(i)
        divisor.append(M // i)
ans = 1
for e in divisor:
    if e > ans and e <= M // N:
        ans = e
print(ans)

-# N == 1 の処理 -if N == 1: -    print(M) -    exit() -# Mの素数判定 -judge = "prime" -for i in range(m.floor(pow(M, 1 / 2)), 1, -1): +divisor = [] +for i in range(1, m.floor(pow(M, 1 / 2)) + 1): -        judge = "conposite" -        break -if judge == "prime": -    print((1)) -    exit() -for i in range(M // N, 0, -1): -    if M % i == 0: -        print(i) -        exit() +        divisor.append(i) +        divisor.append(M // i) +ans = 1 +for e in divisor: +    if e > ans and e <= M // N: +        ans = e +print(ans)