n, k = map(int, input().split()) if n == 1: print(1) exit() if k != n-1: print(n-1) else: print(n)