import math



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



if N == 1:

    print(M)

else:

    d = max(d for d in range(1, math.ceil(M / (N - 1))) if M % d == 0)

    print(d)

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



if N == 1:

    print(M)

else:

    d = max(d for d in range(1, M // N + 1) if M % d == 0)

    print(d)

import math

N, M = list(map(int, input().split()))
if N == 1:
    print(M)
else:
    d = max(d for d in range(1, math.ceil(M / (N - 1))) if M % d == 0)
    print(d)

N, M = list(map(int, input().split()))
if N == 1:
    print(M)
else:
    d = max(d for d in range(1, M // N + 1) if M % d == 0)
    print(d)

-import math - -    d = max(d for d in range(1, math.ceil(M / (N - 1))) if M % d == 0) +    d = max(d for d in range(1, M // N + 1) if M % d == 0)