def get(): return list(map(int, input().strip().split(' '))) N, K = get() def counting(n, k): s = [[k, k]] count = 0 while len(s) > 0: x, y = s.pop() if y <= n: count += 1 s.append([x, y + 1]) s.append([y + 1, y + 1]) elif x < n: s.append([x + 1, x + 1]) return count count = counting(N, K) print(count)