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