def gcd(x,y): return gcd(y,x%y) if y != 0 else x N,K = map(int,input().split()) ans = 0 for i in range(1,N): ans = max(ans,gcd(i,N-i)) print(ans)