= Solution
Treat the simulated pairs $(x_i,m_i)$ as samples from the prior $P(x,m)$. The numerator and denominator of the posterior mean are then ordinary <Monte Carlo estimators>, so
$$
\bar m\simeq\frac{\sum_{i=1}^Km_iP(d\mid x_i)}
{\sum_{j=1}^KP(d\mid x_j)}
=\sum_{i=1}^Km_iw_i,
$$
where the normalized <importance sampling> weights are
$$
\boxed{w_i=\frac{\exp[-(d-x_i)^2/(2\sigma^2)]}
{\sum_{j=1}^K\exp[-(d-x_j)^2/(2\sigma^2)]}.}
$$
The common Gaussian normalizing constant cancels.
Back to article page