from sys import stdin

n,m = list(map(int,stdin.readline().rstrip().split()))

def make_divisors(n):

    divisors = []

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

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)

    divisors.sort()

    return divisors

li = make_divisors(m)

point = 1

if n == 1:

    print(m)

    exit()

for i in range(1,len(li)):

    if m//li[i] < n:

        point = li[i-1]

        break

print(point)
from sys import stdin

n,m = list(map(int,stdin.readline().rstrip().split()))

def make_divisors(n):

    divisors = []

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

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)

    divisors.sort()

    return divisors

li = make_divisors(m)

point = m

for i in range(1,len(li)):

    if m//li[i] < n:

        point = li[i-1]

        break

print(point)
from sys import stdin

n, m = list(map(int, stdin.readline().rstrip().split()))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    divisors.sort()
    return divisors


li = make_divisors(m)
point = 1
if n == 1:
    print(m)
    exit()
for i in range(1, len(li)):
    if m // li[i] < n:
        point = li[i - 1]
        break
print(point)

from sys import stdin

n, m = list(map(int, stdin.readline().rstrip().split()))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    divisors.sort()
    return divisors


li = make_divisors(m)
point = m
for i in range(1, len(li)):
    if m // li[i] < n:
        point = li[i - 1]
        break
print(point)

-point = 1 -if n == 1: -    print(m) -    exit() +point = m