N, K = map(int, input().split()) if N == K: print(K) else: print(K + 1)