if(list.get(maxSumStartIndex) + list.get(maxSumLastIndex) == maxSum && maxSumStartIndex > 0 && list.get(maxSumStartIndex) != list.get(maxSumLastIndex)){
maxSumStartIndex = list.indexOf(maxSum - list.get(maxSumStartIndex));
maxSumLastIndex = list.indexOf(maxSum - list.get(maxSumLastIndex));
}