N, K = map(int, input().split()) if N == 1: exit(print(1)) if K == N - 1: print(N) else: print(N - 1)