Let us define the infinitely-many-variable formal power series ring
$$ K[[X_1,\ldots,X_{\infty}]] \colon= \underset{m \geq 1}{\varprojlim}\,K[[X_1,\ldots,X_m]]. $$
$K[[X_1,\ldots,X_{\infty}]]$ is known to be a UFD by a theorem of Nishimura (c.f. On the unique factorisation theorem for formal power series, Journal Math. Kyoto. Univ. Vol 7. No 2. 1967, 151-160).
Now let us choose an irreducible element $f \in K[[X_1,\ldots,X_{\infty}]]$ and consider the image $f_m \in K[[X_1,\ldots,X_m]]$ of $f$ by the natural quotient ring homomorphism $K[[X_1,\ldots,X_{\infty}]] \twoheadrightarrow K[[X_1,\ldots,X_m]]$.