n,k = map(int, input().split()) a = (n*(n+1)//2 - (n-k)*(n-k+1))//2 ans = n*(n+1)//4 + a + 1 + k % 2 print(ans)