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-1): ans = max(ans,gcd(i,N-i)) print(ans)