A, B = map(int, input().split()) if B > A: print(B - 2) else: print(1999999998)