""" N番目か """ import sys from sys import stdin N,K = map(int,stdin.readline().split()) if N == 1: print (1) elif K == N-1: print (N) else: print (N-1)