while(True):
try:
Inp=input()
InpList=Inp.split(' ')
if((int(InpList[0])-int(InpList[1]))>0):
print(1+int(InpList[1]))
else:
print(int(InpList[1]))
except:
break