def make_divisors(n): divisors = [] #必要に応じてsetにしても良いかも i = 1 while i ** 2 <= n: if n % i == 0: divisors.append(i) if i ** 2 != n: divisors.append(n//i) i += 1 divisors.sort() return divisors N,K = map(int,input().split()) print(make_divisors(N)[-2])