the indices of the selected keys: key i is where segment i starts, the last key where the last segment ends