A, B = map(int, input().split()) if A < B: # A < B > C ans = B - 2 elif A > B: # A > B < C ans = (2 * 10**9) - 2 print(ans)