Why not use the information stored in vec_removed directly? Assume vec_remove contains indices i_1 < i_2 < ... < i_n. Then the new elements are in the range [0, i_1-1], [i_1+1, i_2-1], ..., [i_n+1, n_orig_elements]. Maybe the begin and the end needs special handling when i_1 == 0 or i_n == n_orig_elements.