n,k=map(int,input().split()) ans = 1 for i in range(1,1+n): if n%i==0 and n//i>=k: ans=i print(ans)