Reading through a text on computability I came across a c.e. set defined as follows: Let $K=\lbrace x \in W_x \rbrace$ and let $f$ be a computable function. Then there exists $n \in \omega$ such that $W_n=\lbrace x \in K : x \leq f(n) \rbrace$.

My question is how can we find such an index $n$? My first thought was to let $g$ be a computable function such that $g(k)$ enumerates an index for $\lbrace x \in K : x \leq f(k)\rbrace$ and then apply the Kleene Recursion Theorem to obtain the desired index. But thinking about it, I cannot figure out how to actually name a computable function $g$ which enumerates the desired indices. Any help here?