# Python3勉強中 import math n,k = list(map(int,input().split())) r = 0 for x in range(1,int(n/2)+1): y = n - x r = max(r,math.gcd(x,y)) print(r)