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