4. In Example 8 of $\S 4$, when $(n, k)=d>1$, if the numbers in set $M$ are colored according to conditions (i), (ii), how many different colors can the numbers in $M$ be painted at most?
4. $[d / 2]+1$.

The above text has been translated into English, retaining the original text's line breaks and format.