import sys input=lambda:sys.stdin.readline().rstrip() N,K=map(int,input().split()) print(K-1 if K