CodeEff/ECCO huggingface dataset:
# Original solution
import math
N, M = [int(i) for i in input().split()]

ans = 1
for i in range(N, M):
    if M % i == 0:
        ans = M / i
        break

print((int(ans)))

# Optimized solution
import math
N, M = [int(i) for i in input().split()]

ans = 1
sosu = True if M % 2 == 1 else False

if M % 2 == 1:
    sqrt = int(math.ceil(math.sqrt(M)))
    for i in range(3, sqrt, 2):
        if M % i == 0:
            sosu = False
            break

if sosu == False:
    for i in range(N, M):
        if M % i == 0:
            ans = M / i
            break


print((int(ans)))
# Original solution
import itertools
n,m=list(map(int,input().split()))
mv=m
l=[]
for i in range(2,int(m**0.5)+1):
	while m%i==0:
		l.append(i)
		m//=i
if m>1:l.append(m)
elif m==1 and l is None:l.append(1)

comb=set()
for i in range(len(l)+1):
	for x in itertools.combinations(l,i):
		comb.add(x)
		
ans=1
for i in comb:
	res=1
	for j in i:
		res*=j
	if res<=mv//n:
		ans=max(ans,res)
print(ans)

# Optimized solution
n,m=list(map(int,input().split()))
divis=[]
for i in range(1,int(m**0.5)+1):
	if m%i==0:
		divis.append(i)
		if i!=m//i:
			divis.append(m//i)
ans=1
for i in divis:
	if i<=m//n:
		ans=max(ans,i)
print(ans)
# Original solution
from collections import Counter


def factorization(n):
    arr = Counter()
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if len(list(arr.keys())) == 0 and n != 1:
        arr[n] = 1

    return arr


N, M = list(map(int, input().split()))
primes = factorization(M)
primeList = list(primes.elements())

ans = 1
for i in range(2 ** len(primeList)):
    t = 0
    x = 1
    while (i >> t) > 0:
        d = primeList[t] if (i >> t) & 1 else 1
        x *= d
        t += 1
    if M // x >= N:
        ans = max(ans, x)

print(ans)


# Optimized solution
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 6)


def factorization(n):
    arr = Counter()
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if len(list(arr.keys())) == 0 and n != 1:
        arr[n] = 1

    return arr


def dfs(i, x):
    global N, M, ans
    if i == len(primeKeys):
        if M // x >= N:
            ans = max(ans, x)
    else:
        for j in range(primes[primeKeys[i]] + 1):
            nx = x * (primeKeys[i] ** j)
            if M // nx >= N:
                dfs(i + 1, nx)
            else:
                break


N, M = list(map(int, input().split()))
primes = factorization(M)
# primeList = list(primes.elements())
primeKeys = list(primes.keys())

ans = 1
dfs(0, 1)

print(ans)
# Original solution
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 6)


def factorization(n):
    arr = Counter()
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if len(list(arr.keys())) == 0 and n != 1:
        arr[n] = 1

    return arr


def dfs(i, x):
    global N, M, ans
    if i == len(primeKeys):
        if M // x >= N:
            ans = max(ans, x)
    else:
        for j in range(primes[primeKeys[i]] + 1):
            nx = x * (primeKeys[i] ** j)
            if M // nx >= N:
                dfs(i + 1, nx)
            else:
                break


N, M = list(map(int, input().split()))
primes = factorization(M)
# primeList = list(primes.elements())
primeKeys = list(primes.keys())

ans = 1
dfs(0, 1)

print(ans)


# Optimized solution
from math import sqrt


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

ans = 1
for i in range(1, int(sqrt(M)) + 1):
    if M % i == 0:
        j = M // i
        if M / N >= j:
            ans = max(ans, j)
        elif M / N >= i:
            ans = max(ans, i)

print(ans)
# Original solution
import sys
input= sys.stdin.readline

N,M = list(map(int,input().split()))
g=max(M//N,M**0.5)#最大公約数になる可能性のある最大値
for i in range(M-N+1):
  if M%(N+i)==0:
    print((M//(N+i)))
    exit()

# Optimized solution
import sys
input= sys.stdin.readline

N,M = list(map(int,input().split()))
g=M//N#最大公約数になる可能性のある最大値
for i in range(g):
  if M%(g-i)==0:
    print((g-i))
    exit()
  if M%(N+i)==0:
    print((M//(N+i)))
    exit()
# Original solution
N,M = list(map(int,input().split()))
divs = set()
n = 1
while n*n <= M:
    if M%n == 0:
        divs.add(n)
        divs.add(M//n)
    n += 1

ans = 0
for d in divs:
    if d*N <= M:
        ans = max(ans, d)
print(ans)

# Optimized solution
N,M = list(map(int,input().split()))
d = set()
m = 1
while m*m <= M:
    if M%m==0:
        d.add(m)
        d.add(M//m)
    m += 1

ans = 1
for n in d:
    m = M//n
    if m >= N:
        ans = max(ans,n)
print(ans)
# Original solution
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(10**7)
p_list = set(prime_list)

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

ans = 1

for i in prime_list:
    if n * i > m:
        break
    if m % i == 0:
        num = m // i
        if num in p_list:
            ans = i
        elif num < n:
            continue
        elif num >= i * n:
            a = num // n
            ans = i * a
    else:
        continue

print(ans)

# Optimized solution
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

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

ans = 1

div = make_divisors(m)

for i in div:
    if i * n <= m:
        ans = i
    else:
        break

print(ans)
# Original solution
# -*- coding: utf-8 -*-
from collections import defaultdict
from bisect import bisect
def inpl(): return list(map(int, input().split()))

def primes(N):
    sieve = [True]*(N+1)
    sieve[:2] = [False, False]
    for i in range(4, N+1, 2):
        sieve[i] = False

    for i in range(3, N+1, 2):
        if sieve:
            for j in range(2*i, N+1, i):
                sieve[j] = False
    P = []
    for i in range(N+1):
        if sieve[i]:
            P.append(i)
    return P

N, M = inpl()
P = primes(10**6)
searched = defaultdict(int)

Q = [1]

if N==1:
    print(M)
    exit()

if M%N == 0:
    ans = M//N
else:
    ans = 1
while Q:
    a = Q.pop()
    for p in P:
        c = a*p
        d = M - c*N
        if d < 0:
            break
        
        if d%c == 0:
            if not searched[c]:
                searched[c] = True
                ans = max(ans, c)
                Q.append(c)
print(ans)

# Optimized solution
# -*- coding: utf-8 -*-
from math import sqrt, ceil
def inpl(): return list(map(int, input().split()))

N, M = inpl()
ans = 1
for i in range(1, ceil(sqrt(M))+1):
    if M%i != 0:
        continue
    d = M // i
    if M >= N*i:
        ans = max(i, ans)
    if M >= N*d:
        ans = max(d, ans)

print(ans)
# Original solution
from math import *

def main():
    N, M = list(map(int, input().split()))
    special_value = M//N
    divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
    divisor_set = divisor_set.union(M//j for j in divisor_set)
    print((int(max([i for i in divisor_set if special_value >= i]))))
    return

main()

# Optimized solution
from math import *

def main():
    N, M = list(map(int, input().split()))
    special_value = M//N
    divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
    divisor_set = divisor_set.union(M//j for j in divisor_set)
    print((int(max(divisor_set, key=lambda x: x if special_value >= x else -1))))

    return

main()
# Original solution
from math import *

N, M = list(map(int, input().split()))
special_value = M//N
divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
divisor_set = divisor_set.union(M//j for j in divisor_set)
print((int(max(divisor_set, key=lambda x: x if special_value >= x else -1))))

# Optimized solution
from math import *

def main():
    N, M = list(map(int, input().split()))
    special_value = M//N
    divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
    divisor_set = divisor_set.union(M//j for j in divisor_set)
    print((int(max(divisor_set, key=lambda x: x if special_value >= x else -1))))

    return

if __name__ == "__main__":
    main()
# Original solution
import math


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

for i in range(1, math.floor(m/n) + 1):
    if m % i == 0:
        ans = i

print(ans)

# Optimized solution
import math


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

for i in range(math.floor(m/n), 0, -1):
    if m % i == 0:
        ans = i
        break

print(ans)
# Original solution
N,M = list(map(int, input().split()))

li = []
for i in range(1, M + 1):
    if i * i > M:
        break
    if M % i == 0:
        li.append(i)
        li.append(M // i)

ans = 1

li.sort(reverse=True)

for i in li:
    if N * i <= M:
        ans = i
        break

print(ans)


# Optimized solution
# D. Partition
# https://atcoder.jp/contests/abc112/tasks/abc112_d

# 約数列挙

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

    upper_divisors.reverse()
    return lower_divisors + upper_divisors

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

box = make_divisors(m)

for i in range(len(box)):
  if box[i] >= n:
    print((m // box[i]))
    exit()
# Original solution
from collections import Counter
n, m = list(map(int, input().split()))

def factorize(m):
    c = Counter()
    t = 2
    while t**2 <= m:
        if m % t:
            t += 1
            continue
        while not m%t:
            c[t] += 1
            m //= t
    if m > 1:
        c[m] += 1
    return c
yakusu = [1]
for key, value in list(factorize(m).items()):
    next_yakusu = []
    for i in range(value+1):
        for j in yakusu:
            next_yakusu.append(j*key**i)
    yakusu = next_yakusu

ans = 1
for i in yakusu:
    if n <= m//i:
        ans = max(ans, i)
print(ans)

# Optimized solution
from math import sqrt
n, m = list(map(int, input().split()))
ans = 1
for i in range(int(sqrt(m))):
    if m%(i+1)==0:
        if n <= m//(i+1) : ans= max(ans, i+1)
        if n <= i+1 : ans = max(ans,m//(i+1))
print(ans)
# Original solution
N, M = [int(_) for _ in input().split()]

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a

result = 1

a = 1

while True:
    b = M - (a * (N - 1))
    if b < 1:
        break
    # print(a, b)
    x = gcd(a, b)
    result = max(result, x)
    a += 1

print(result)

# Optimized solution
import math

N, M = [int(_) for _ in input().split()]


sr = int(math.sqrt(M))

result = 1

for i in range(sr, 0, -1):
    if M % i == 0:
        r = i
        if M >= N * r:
            result = max(r, result)
        r = M // i
        if i >= N:
            result = max(r, result)

print(result)
# Original solution
import sys


def main():
    N, M = list(map(int, input().split()))
    s = M // N  # 答えはs以下
    m = M % N

    for i in range(s, 0, -1):
        if m % s == 0:
            print(s)
            sys.exit()
        else:
            s -= 1
            m += N


main()


# Optimized solution
import sys


def main():
    N, M = list(map(int, input().split()))
    s = M // N  # 答えはs以下
    m = M % N

    for i in range(s, 0, -1):
        if m % i == 0:
            print(i)
            sys.exit()
        else:
            m += N


main()
# Original solution
import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(eval(input()))
def getNM():
    return list(map(int, input().split()))
def getlist():
    return list(map(int, input().split()))
import math
import heapq
import fractions
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15

def getyaku(n):
    res = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            res.append(i)
            res.append(n // i)

    return(sorted(list(set(res))))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():
    n,m = getlist()
    arr = getyaku(m)
    for num in arr:
        if num >= n:
            print((m//num))
            return
    print((1))
    # print(arr)
    return

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

# Optimized solution
def getN():
    return int(eval(input()))
def getNM():
    return list(map(int, input().split()))
def getList():
    return list(map(int, input().split()))

from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left, bisect_right
import heapq
import sys
# sys.setrecursionlimit(1000000)
INF = 10 ** 17
MOD = 998244353
def mint(lis):
    return list(map(int, lis))

def bifind(arr_sorted, x):
    idx = bisect_left(arr_sorted, x)
    if idx == len(arr_sorted):
        return False
    if arr_sorted[idx] == x:
        return True
    else:
        return False
def getyaku(n):
    ret = []
    for i in range(1, int(math.sqrt(n) + 1)):
        if n % i == 0:
            ret.append(i)
            ret.append(n // i)

    return ret

def main():
    n, m = getList()
    ans = 0
    for yaku in getyaku(m):
        if m // yaku >= n:
            if ans < yaku:
                ans = yaku
    print(ans)

if __name__ == "__main__":
    main()
# Original solution
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and (is_prime(i) or i==1) and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
for i in range(n,m+1):
  if i==m:
    print((1))
    break
  if m%i==0:
    print((m//i))
    break
  if m-i-n>0 and m%(m-i-n)==0 and m//(m-i-n)>n:
    print((m-i-n))
    break


# Optimized solution
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and (is_prime(i) or i==1) and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
for i in range(n,m+1):
  if i==m:
    print((1))
    break
  if m%i==0:
    print((m//i))
    break
# Original solution
N, M = list(map(int, input().split(" ")))
flg = 0
for i in range(N, M+1):
    if M % i == 0:
        print((M//i))
        flg = 1
        break
    if i**2 > M:
        break

if flg == 0:
    for i in range(M//N, 0, -1):
        if M % i == 0:
            print (i)
            break

# Optimized solution
def primeFactor(N):
    i = 2
    ret = {}
    n = N
    if n < 0:
        ret[-1] = 1
        n = -n
    if n == 0:
        ret[0] = 1
    while i**2 <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
            ret[i] = k
        i += 1
    if n > 1:
        ret[n] = 1
    return ret

def isPrime(N):
    if N <= 1:
        return False
    return sum(primeFactor(N).values()) == 1

def findPrime(N):
    if N < 0:
        return -1
    i = N
    while True:
        if isPrime(i):
            return i
        i += 1

def divisor(N):
    pf = primeFactor(N)
    ret = [1]
    for p in pf:
        ret_prev = ret
        ret = []
        for i in range(pf[p]+1):
            for r in ret_prev:
                ret.append(r * (p ** i))
    return sorted(ret)
    
N, M = list(map(int, input().split(" ")))

for i in divisor(M):
    if i >= N:
        print((M//i))
        break
# Original solution
N, M = list(map(int, input().split()))
a = M//N
ans = 0
for i in range(1, a+1):
    if M%i == 0:
        ans = i
print(ans)

# Optimized solution
N, M = list(map(int, input().split()))
a = M//N
ans = 0
ok = True
for i in range(1, a+1):
    if M%i == 0:
        ans = i
        if M//i <= a:
            print((M//i))
            ok = False
            break
if ok:
    print(ans)
# Original solution
iN,iM = [int(_) for _ in input().split()]
iD = iM // iN
if iM % iN == 0:
    print(iD)
else:
    for i in range( iD , 0,-1):
        if iM % i == 0:
            print(i)
            exit()


# Optimized solution
iN,iM = [int(_) for _ in input().split()]
iD = iM // iN
if iM % iN == 0:
    print(iD)
elif 2*iN > iM :
    print((1))
else:
    aD = []
    for i in range(1,int(iM**0.5)+1):
        if iM % i == 0:
            if iD > i : aD.append(i)
            j = iM // i
            if iD > j :aD.append(j)
    print((max(aD)))
# Original solution
iN,iM = [int(_) for _ in input().split()]
iD = iM // iN
if iM % iN == 0:
    print(iD)
elif 2*iN > iM :
    print((1))
else:
    aD = []
    for i in range(1,int(iM**0.5)+1):
        if iM % i == 0:
            if iD > i : aD.append(i)
            j = iM // i
            if iD > j :aD.append(j)
    print((max(aD)))


# Optimized solution
def 解():
    iN,iM = [int(_) for _ in input().split()]
    iD = iM // iN
    if iM % iN == 0:
        print(iD)
    elif 2*iN > iM :
        print((1))
    else:
        aD = []
        for i in range(1,int(iM**0.5)+1):
            if iM % i == 0:
                if iD > i : aD.append(i)
                j = iM // i
                if iD > j :aD.append(j)
        print((max(aD)))
解()
# Original solution
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: list(map(int, sys.stdin.readline().split()))
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    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(reverse=True)
        return divisors

    n, m = ns()
    gcd = make_divisors(m)

    max_gcd = 1
    for d in gcd:
        if m // d >= n:
            max_gcd = d
            break

    print(d)


if __name__ == '__main__':
    main()


# Optimized solution
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: list(map(int, sys.stdin.readline().split()))
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    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(reverse=True)
        return divisors

    n, m = ns()
    gcd = make_divisors(m)

    max_gcd = 1
    for d in gcd:
        if m // d >= n:
            max_gcd = max(max_gcd, d)

    print(max_gcd)


if __name__ == '__main__':
    main()
# Original solution
import collections
import itertools
import math


def eratosthenes(n):
    sieve = [True for _ in range(n + 1)]
    sieve[0] = False
    sieve[1] = False

    def _update(p):
        if sieve[p]:
            for i in range(p * 2, n + 1, p):
                sieve[i] = False

    _update(2)
    p = 3
    while p * p <= n:
        _update(p)
        p += 2
    return sieve


n, m = list(map(int, input().split()))
m2 = math.ceil(math.sqrt(m)) + 1
sieve = eratosthenes(m2)
counter = collections.Counter()

mm = m
for k in range(2, m2):
    if sieve[k] and m % k == 0:
        while mm % k == 0:
            mm //= k
            counter[k] += 1
if mm > 1:
    counter[mm] += 1

es = [list(range(k + 1)) for k in list(counter.values())]
res = 1
for ks in itertools.product(*es):
    x = 1
    for p, k in zip(list(counter.keys()), ks):
        x *= p**k
    if x <= m // n:
        res = max(res, x)
print(res)

# Optimized solution
import math

n, m = list(map(int, input().split()))
mm = m // n
res = []
for k in range(int(math.sqrt(m)), 0, -1):
    if m % k == 0:
        if k > mm:
            continue
        if m // k <= mm:
            k = m // k
        res.append(k)
print((max(res)))
# Original solution
N, M = list(map(int, input().split()))

ans = 1
for i in range(1,int(M ** 0.5) + 1):
    if M % i == 0:
        if i >= N:
            ans = max(ans, M // i)
        if M // i >= N:
            ans = max(ans, i)
print((int(ans)))


# Optimized solution
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


n,m=list(map(int,input().split()))
for i in make_divisors(m)[::-1]:
    if n*i<=m:print(i);break
# Original solution
n,m = list(map(int,input().split()))
while True:
  if m%n == 0:
    print((m//n))
    break
  n += 1

# Optimized solution
n,m = list(map(int, input().split()))
if n*n <= m:
  k = n
  while k*k <= m:
    if m%k == 0:
      print((m//k))
      exit()
    k += 1
else:
  n = m//n

k = n
while True:
  if m%k == 0:
    print(k)
    exit()
  k -= 1
# Original solution
N, M = [int(x) for x in input().strip().split(' ')]

for i in range(M//N):
#    n = N-i
    n = M//N-i
    if M % n == 0:
#        if M//n >= N:
        print(n)
        break


# Optimized solution
N, M = [int(x) for x in input().strip().split(' ')]

if N >= 1000:
    for i in range(M//N):
        n = (M//N)-i
        if M % n == 0:
            print(n)
            break
else:
    x = M//(M//N)
    for i in range(M):
        i = x +i
        if M % i == 0:
            print((M//i))
            break
# Original solution
from itertools import *
n,m=list(map(int,input().split()))
M=m
a=[1]
for i in range(2,int(m**.5)+1):
    while m%i==0:
        m//=i
        a+=[i]
if m!=1:a+=[m]
ans=1
for i in range(len(a)):
    for b in combinations(a,i):
        c=1
        for j in b:
            c*=j
        if c>=n:
            ans=max(ans,M//c)
print(ans)

# Optimized solution
from itertools import *
n,m=list(map(int,input().split()))
M=m
a=[1]
for i in range(2,int(m**.5)+1):
    while m%i==0:
        m//=i
        a+=[i]
if m!=1:a+=[m]
ans=1
for i in range(len(a)):
    for b in combinations_with_replacement(set(a),i):
        c=1
        for j in b:c*=j
        if c>=n and M%c==0:ans=max(ans,M//c)
print(ans)