Buggy python submission (verdict: Time Limit Exceeded):
import math
n, m = map(int, input().split())

def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if m%n==0:
    print(m//n)

elif is_prime(m):
    print(1)

else:
    index=m//n
    while index >0:
        if m%index==0:
            print(index)
            break
        index-=1

Fixed submission:
import math
import time
n, m = map(int, input().split())
flag=0
if m%n==0:
    print(m//n)

else:
    start = time.time()
    index=m//n
    while index >0:
        elapsedTime = time.time()-start
        if elapsedTime > 1:
            flag=1
            break
        elif m%index==0:
            print(index)
            break
        index-=1

    if flag==1:
        index = 1
        while index < m+1:
            if m % index == 0:
                if index > n-1:
                    print(m//index)
                    break
            index += 1

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
if m%n==0:
    print(m//n)
else:
    index=m//n
    while index >0:
        if m%index==0:
            print(index)
            break
        index-=1

Fixed submission:
import math
import time
n, m = map(int, input().split())
flag=0
if m%n==0:
    print(m//n)

else:
    start = time.time()
    index=m//n
    while index >0:
        elapsedTime = time.time()-start
        if elapsedTime > 1:
            flag=1
            break
        elif m%index==0:
            print(index)
            break
        index-=1

    if flag==1:
        index = 1
        while index < m+1:
            if m % index == 0:
                if index > n-1:
                    print(m//index)
                    break
            index += 1

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
if m%n==0:
    print(m//n)
elif n > m//2:
    index = m
    while index >0:
        if m%index==0:
            if m//index > n-1:
                print(index)
                break
        index+=1
else:
    index=1
    while index <m+1:
        if m%index==0:
            if index > n-1:
                print(m//index)
                break
        index+=1


Fixed submission:
import math
import time
n, m = map(int, input().split())
flag=0
if m%n==0:
    print(m//n)

else:
    start = time.time()
    index=m//n
    while index >0:
        elapsedTime = time.time()-start
        if elapsedTime > 1:
            flag=1
            break
        elif m%index==0:
            print(index)
            break
        index-=1

    if flag==1:
        index = 1
        while index < m+1:
            if m % index == 0:
                if index > n-1:
                    print(m//index)
                    break
            index += 1

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
if m%n==0:
    print(m//n)
else:
    index=1
    while index <m+1:
        if m%index==0:
            if index > n-1:
                print(m//index)
                break
        index+=1

Fixed submission:
import math
import time
n, m = map(int, input().split())
flag=0
if m%n==0:
    print(m//n)

else:
    start = time.time()
    index=m//n
    while index >0:
        elapsedTime = time.time()-start
        if elapsedTime > 1:
            flag=1
            break
        elif m%index==0:
            print(index)
            break
        index-=1

    if flag==1:
        index = 1
        while index < m+1:
            if m % index == 0:
                if index > n-1:
                    print(m//index)
                    break
            index += 1

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
if m%n==0:
    print(m//n)
else:
    index=m
    while index >0:
        if m%index==0:
            if m//index > n-1:
                print(index)
                break
        index-=1

Fixed submission:
import math
import time
n, m = map(int, input().split())
flag=0
if m%n==0:
    print(m//n)

else:
    start = time.time()
    index=m//n
    while index >0:
        elapsedTime = time.time()-start
        if elapsedTime > 1:
            flag=1
            break
        elif m%index==0:
            print(index)
            break
        index-=1

    if flag==1:
        index = 1
        while index < m+1:
            if m % index == 0:
                if index > n-1:
                    print(m//index)
                    break
            index += 1

Buggy python submission (verdict: Time Limit Exceeded):
import math
n,m = map(int, input().split())
if m%n==0:
    print(m//n)
else:
    def make_divisor_list(num):
        if num < 1:
            return []
        elif num == 1:
            return [1]
        else:
            divisor_list = []
            divisor_list.append(1)
            for i in range(2, num // 2 + 1):
                if num % i == 0:
                    divisor_list.append(i)
            divisor_list.append(num)

            return divisor_list
    
    listD = make_divisor_list(m)
    index =0
    while index <len(listD):
        if listD[index]>n-1:
            print(m//listD[index])
            break
        index+=1


Fixed submission:
import math
import time
n, m = map(int, input().split())
flag=0
if m%n==0:
    print(m//n)

else:
    start = time.time()
    index=m//n
    while index >0:
        elapsedTime = time.time()-start
        if elapsedTime > 1:
            flag=1
            break
        elif m%index==0:
            print(index)
            break
        index-=1

    if flag==1:
        index = 1
        while index < m+1:
            if m % index == 0:
                if index > n-1:
                    print(m//index)
                    break
            index += 1