A, B = map(int, raw_input().split()) M = 2000000000 if A < B: ans = A - 1 else: ans = M - A print ans