Let $S$ be the sum of the first 9 terms of the series : $\{x+k a\}+\left\{x^2+(k+2) a\right\}+\left\{x^3+(k+4) a\right\}+\left\{x^4+(k+6) a\right\}+\ldots$ where $a \neq 0$ and $x \neq 1$. If $S=\frac{x^{10}-x+45 a(x-1)}{x-1}$, then $k$ is equal to :