n,k = map(int,input().split()) if n == k: print(k-1) else: print(k+1)