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