def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N, K = mapint_inp()

l = list(range(N+1))
mn_list = []
for i in range(K, N+2):
    mn_list.append(sum(l[:i]))

r = l[::-1]
mx_list = []
for i in range(K, N+2):
    mx_list.append(sum(r[:i]))

ans = 0
for j in range(N):
    ans += mx_list[j]-mn_list[j]+1

print(ans)