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