output_description: Print the maximum possible value of the greatest common divisor of a sequence
  a_1, a_2, ..., a_N that satisfies the condition.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
attempt: import random
  
  def is_prime(q,k=50):
      if q == 2: return True
      if q < 2 or q&1 == 0: return False
      d = (q-1)>>1
      while d&1 == 0:
          d >>= 1
      for i in range(k):
          a = random.randint(1,q-1)
          t = d
          y = pow(a,t,q)
          while t != q-1 and y != 1 and y != q-1: 
              y = pow(y,2,q)
              t <<= 1
          if y != q-1 and t&1 == 0:
              return False
      return True
  
  n,m=(int(i) for i in input().split(' '))
  if m%n>10000:
    for i in range(1,n):
      if m%i==0 and is_prime(i) and is_prime(m//i) and (i==1 or m//i<n):
        print('1')
        exit()
  for i in range(n,m+1):
    if i==m:
      print(1)
      break
    if m%i==0:
      print(m//i)
      break
    if m%(m-i+1)==0
      print(m-i+1)
      break
  
problem_description: Statement
  
  You are given integers N and M.
  
  Consider a sequence a of length N consisting of positive integers such that
  a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest
  common divisor of a_1, a_2, ..., a_N.
samples: [{"input": "3 14", "output": "2\n    \n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common\ndivisor is 2, and this is the maximum value.\n\n* * *"}, {"input": "10 123", "output": "3\n    \n\n* * *"}, {"input": "100000 1000000000", "output": "10000"}]