n,m=list(map(int,input().split()))

for i in range(m//n+1)[::-1]:

	if m%i<1:

		print(i)

		exit()
n,m=list(map(int,input().split()))

ans=1

for i in range(1,int(m**.5)+1):

  if m%i==0:

    if i*n<=m and ans<i:

      ans=i

    if n<=i and ans<m//i:

      ans=m//i

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

n, m = list(map(int, input().split()))
ans = 1
for i in range(1, int(m**0.5) + 1):
    if m % i == 0:
        if i * n <= m and ans < i:
            ans = i
        if n <= i and ans < m // i:
            ans = m // i
print(ans)

-for i in range(m // n + 1)[::-1]: -    if m % i < 1: -        print(i) -        exit() +ans = 1 +for i in range(1, int(m**0.5) + 1): +    if m % i == 0: +        if i * n <= m and ans < i: +            ans = i +        if n <= i and ans < m // i: +            ans = m // i +print(ans)