import sys input = sys.stdin.readline from collections import * N, K = map(int, input().split()) if K==N-1: print(N) else: print(N-1)