Looks like a "normal" index misscalculation, most likely on line
A[((2 * (id + 1)) - 1)] = A[(2 * (id + 1)) - 1] + A[(2 * (id + 1))- 2-index];
But:
* Don't you know what this (very common) error message means?
* Can't you use debugger or tracing to work out the error?
Btw. This is what happens if you(or me):
don't use "good" names for your variables and methods.
do all your calculations inline (hard to debug)
don't use build in "goodies" like LINQ to make your life easier.
I think you may find the bug for yourself, but maybe consider another aproach:
First get the subset from the array (value list) you want to sum, then calculate sum with built-in function.
Avoid index calculation and "crazy" indexing math. For shure you know what you have written there, but this can become a maintenance nightmare...
just my 2c..