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