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