def div(n): if n <= 0: return [] S = set() i = 1 while i * i <= n: if n % i == 0: S.add(i) S.add(n // i) i += 1 return list(S) N, K = map(int, input().split()) ans = 1 for d in div(N): if d >= K: ans = max(ans, N//d) print(ans)