1sizeOfRange,otherpick=map(int,input().split())
2if(sizeOfRange==1 and otherpick==1):
3 print(sizeOfRange)#1 number cant really fight can you
4else:
5 if(sizeOfRange/2<otherpick):
6 print(otherpick-1)
7 else:
8 print(otherpick+1)
9#so in a show of guessing the price of a object
10#there is only 2 contestent
11#price of the product 100
12#first person says the price is 50 you just say its 50+1 or and you win
13#you can say its 50-1
14#either way its 50/50 chance of wining