a,b = map(int,input().split()) lists = [] if a <= b: Max = b Min = a else: Max = a Min = b for i in range(a+b+1): if i % 2 == 0: if Max != 0: lists.append("A") Max -= 1 else: if Min != 0: lists.append("B") Min -= 1 cnt = 0 for i in range(1,len(lists)): if lists[i] != lists[i-1]: cnt += 1 print(cnt)