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