N,K = map(int,input().split()) A = set() for i in range(1,N+1): if i*i>N:break if N%i==0: A.add(i) A.add(N//i) A = sorted(list(A)) print(A[-2])