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