Buggy python submission (verdict: Runtime Error):
import numpy as np
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a
def yaku(n):
    fct = factorize(n)
    y = divisorize(fct)
    ys = []
    for yy in y:
        ys.append(num(yy))
    ys.sort()
    return ys

n,m = list(map(int,input().split()))
y = yaku(m)
print(np.max(np.array(y)[np.array(y) <= m/n]))

Fixed submission:
import numpy as np
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a
def yaku(n):
    fct = factorize(n)
    y = divisorize(fct)
    ys = []
    for yy in y:
        ys.append(num(yy))
    ys.sort()
    return ys

n,m = list(map(int,input().split()))
if n == 1 and m == 1:
    print(1)
else:
    y = yaku(m)
    print(np.max(np.array(y)[np.array(y) <= m/n]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a
def yaku(n):
    fct = factorize(n)
    y = divisorize(fct)
    ys = []
    for yy in y:
        ys.append(num(yy))
    ys.sort()
    return ys

n,m = list(map(int,input().split()))
y = yaku(m)
np.max(np.array(y)[np.array(y) <= m/n])

Fixed submission:
import numpy as np
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a
def yaku(n):
    fct = factorize(n)
    y = divisorize(fct)
    ys = []
    for yy in y:
        ys.append(num(yy))
    ys.sort()
    return ys

n,m = list(map(int,input().split()))
if n == 1 and m == 1:
    print(1)
else:
    y = yaku(m)
    print(np.max(np.array(y)[np.array(y) <= m/n]))