Step 1: Recall the angle formula.
For two lines with direction ratios $(a_1,b_1,c_1)$ and $(a_2,b_2,c_2)$, \[ \cos\theta=\frac{a_1a_2+b_1b_2+c_1c_2}{\sqrt{a_1^2+b_1^2+c_1^2}\,\sqrt{a_2^2+b_2^2+c_2^2}}. \]
Step 2: Put in the given ratios.
Here the ratios are $(K,3,5)$ and $(2,-1,2)$, and $\theta=45^\circ$ so $\cos\theta=\dfrac{1}{\sqrt2}$.
Step 3: Build numerator and denominators.
Numerator: $2K-3+10=2K+7$. First length: $\sqrt{K^2+34}$. Second length: $\sqrt{9}=3$. So \[ \frac{2K+7}{3\sqrt{K^2+34}}=\frac{1}{\sqrt2}. \]
Step 4: Cross multiply.
$\sqrt2(2K+7)=3\sqrt{K^2+34}$.
Step 5: Square both sides.
$2(2K+7)^2=9(K^2+34)$, giving $8K^2+56K+98=9K^2+306$, so $K^2-56K+208=0$.
Step 6: Solve the quadratic.
$K=\dfrac{56\pm\sqrt{3136-832}}{2}=\dfrac{56\pm48}{2}$, so $K=52$ or $K=4$. Only $4$ is among the choices. \[ \boxed{4} \]