N, K = map(int, input()) result = 1 for i in range(1, N + 1): if N % i != 0: continue if N // i < K: continue result = max(result, i) print(result)