def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors N, K = map(int, input().split()) l_divisors = make_divisors(N) l_divisors = l_divisors[1:] ans_pair = N for li in l_divisors: if li <= K: ans_pair = li break if ans_pair == N: print(1) else: print(N // ans_pair)