Remove all adjacent values from chunkToCompact, except the last value in any adjacent run. The keyIndices are
parallel to the chunkToCompact; and when a value is removed from chunkToCompact it is also removed from keyIndices
Additionally, verify that the elements are properly ordered; returning the first position of an out of order element.
Parameters:
chunkToCompact - the values to remove duplicates from
keyIndices - the key indices parallel to chunkToCompact
Returns:
the first position of an out-of-order element, or -1 if all elements are in order