Concept:
At equilibrium, each spring stores elastic potential energy
\[
U=\frac12 kx^2.
\]
First find the extension of each spring using force balance.
Step 1: Find the extension of spring \(k_2\).
For mass \(m_2\),
\[
T_2=m_2g.
\]
\[
T_2=(1)(10)=10\ \text{N}.
\]
Hence,
\[
x_2=\frac{T_2}{k_2}
=\frac{10}{500}
=\frac1{50}\ \text{m}.
\]
\[
x_2=0.02\ \text{m}.
\]
Step 2: Find the extension of spring \(k_1\).
Spring \(k_1\) supports both masses.
Therefore,
\[
T_1=(m_1+m_2)g.
\]
\[
T_1=(2+1)10=30\ \text{N}.
\]
Thus,
\[
x_1=\frac{T_1}{k_1}
=\frac{30}{1500}
=\frac1{50}\ \text{m}.
\]
\[
x_1=0.02\ \text{m}.
\]
Step 3: Calculate the energy stored in each spring.
For spring \(k_1\),
\[
U_1
=
\frac12 k_1x_1^2.
\]
\[
=
\frac12(1500)(0.02)^2.
\]
\[
=
0.3\ \text{J}.
\]
For spring \(k_2\),
\[
U_2
=
\frac12 k_2x_2^2.
\]
\[
=
\frac12(500)(0.02)^2.
\]
\[
=
0.1\ \text{J}.
\]
Step 4: Find the total potential energy.
\[
U=U_1+U_2.
\]
\[
U=0.3+0.1.
\]
\[
U=0.4\ \text{J}.
\]
Therefore,
\[
\boxed{U=0.4\ \text{J}}
\]
\[
\boxed{\text{Answer = (B)}}
\]