Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)


Fixed submission:
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    ans = max(ans, fractions.gcd(i, tmp))

print(ans)


Fixed submission:
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions
N, M = map(int, input().split())

k = M // N　+ 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp =  max(M - (N-1)*i,1)
    ans = max(ans, fractions.gcd(i, tmp))

print(ans)


Fixed submission:
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions
N, M = map(int, input().split())

k = M // N　+ 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    ans = max(ans, max(fractions.gcd(i, M - (N-1)*i), 1))

print(ans)


Fixed submission:
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N, M = map(int, input().split())

k = M // N
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    ans = max(ans, fractions.gcd(i, M - (N-1)*i))

print(ans)


Fixed submission:
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N, M = map(int, input().split())

k = M // N
ans = 1
for i in range(1, k+1):
    ans = max(ans, fractions.gcd(i, M - (N-1)*i))
print(ans)


Fixed submission:
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N, M = map(int, input().split())

k = M // N
ans = 1
for i in range(1, k+1):
    ans = max(ans, fractions.gcd(i, M - (N-1)*i))
print(ans)


Fixed submission:
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)