a,b = map(int,input().split()) if b < a: a,b = b,a s = [] for i in range(a+b): if i%2 == 0: if b > 0: s.append(100) b -= 1 else: if a > 0: s.append(200) a -= 1 ans = 0 for i in range(1,len(s)): if s[i-1] != s[i]: ans += 1 print(ans)