Splits array into two parts at index