Concept:
When two identical masses move in opposite directions, the spring stores all the kinetic energy at maximum elongation.
At maximum extension:
\[
\text{Initial K.E.}=\text{Spring Potential Energy}
\]
Step 1: Calculate total initial kinetic energy.
Each block has kinetic energy:
\[
\frac12 mV^2
\]
For two blocks:
\[
2\times \frac12 mV^2
\]
\[
=mV^2
\]
Step 2: Use energy conservation.
At maximum elongation \(x\):
\[
\frac12 Kx^2=mV^2
\]
Multiply both sides by 2:
\[
Kx^2=2mV^2
\]
\[
x^2=\frac{2mV^2}{K}
\]
\[
x=\sqrt{\frac{2mV^2}{K}}
\]
Hence,
\[
\boxed{\sqrt{\frac{2mV^2}{K}}}
\]