n, k = [int(v) for v in input().split()] if n == 1 or n == k + 1: print(n) else: print(n - 1)