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