n,m=list(map(int,input().split()));print((next(v for v in range(m//n,-1,-1)if m%v==0)))
n,m=list(map(int,input().split()));print((next(v for v in range(m//n+1)[::-1]if m%v<1)))
n, m = list(map(int, input().split()))
print((next(v for v in range(m // n, -1, -1) if m % v == 0)))

n, m = list(map(int, input().split()))
print((next(v for v in range(m // n + 1)[::-1] if m % v < 1)))

-print((next(v for v in range(m // n, -1, -1) if m % v == 0))) +print((next(v for v in range(m // n + 1)[::-1] if m % v < 1)))