import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N,K = map(int,read().split()) x = np.arange(1,N+1) div = x[N%x == 0] k = N // div answer = div[k >= 2].max() print(answer)