a,b = map(int,input().split()) if min(a,b)==b: print(2000000000-a) else: print(a-1)