n, k = map(int,input().split()) if n == k == 1: print(1) elif n - 1 == k: print(n) else: print(n - 1)