n, k = map(int, input().split()) def gcd(a, b): if b==0: return a return gcd(b, a%b) print(max(map(lambda i:gcd(i, n-i), range(1, int(n/2)+1))))