N,K=map(int,raw_input().split()) ans=1 for i in range(2,N): if N%i==0: ans=max(ans,i) print ans