return index of sub array that produce sum C