Sort already sorted array - after changing several elements Problem:

Given $S$ &mdash; a sorted array where some of the elements were randomly changed, assuming that you're provided with an $S_1$ &mdash; an array of indexes of changed elements. Design an algorithm that will sort the array in $O(n)$ time.

Additionally, we know that $\text{length of }S_1\le\log_2(\text{length of }S)$.

Example:

$S$ &mdash; [3, 5, 7, (20), 15 ,(0) ,16]

$S_1$ &mdash; [3, 5]

() - Changed elements

Question:

I have some troubles designing the algorithm. My first idea was to just use Count or Radix sort algorithm, but as the values which are changed can be random I've ruled out count sort as potential candidate. 

The second idea is to:


Load the values based on indexes of $S_1$ into new array $S_x$.
Rewrite $S$ without the elements of indexes provided in $S_1$.
Sort $S_x$.
Use "Merge" procedure from Merge Sort on $S_x$ and $S$.


However that still will leave me with $O(n\log n)$ as I'll need to sort $S_x$ array. I'll appreciate any advice on the approach.
Note the length of $S_1$ is no more than $\log_2n$, so the time you need to sort $S_x$ is $O(\log n\log\log n)$, which is $O(n)$.