The problem is NP-complete.

I think that the following algorithm describes a polynomial reduction of SAT to your problem.

Let S be an instance of SAT. So you have a finite set of clauses $C_1$, $C_2$, ...,$C_n$.

and a finite set of variables $p_1$, $p_2$, ..., $p_k$. Each clause contains some literals, i.e., variables $p_i$ and/or negated variable $\lnot p_i$. (in 3sat we assume that each clause contains at most 3 literals.)
We may assume that for each variable $p$ there is a clause $C_p$ containing only $p$ and $\lnot p$, so $n\ge k$.

Make S into a graph as follows: There is a special vertex $ s$. For each variable $p$ there are two vertices $p$ and $\lnot p$, both connected to $s$ (EDITED to simplify) by an edge. There is a vertex for every clause. Each literal $L$ is connected by an edge to each clause $C$ in which $L$ appears.

The set $M$ will be the set of all clauses.

If the original problem S was satisfiable, say with an assignment $A$, then
then there is an optimal tree with $n+k$ edges:
Connect $s$ with all literals which are true under $A$, and connect each clause $C$ with a literal $L$ in $C$ that is true under $A$.

(EDITED to clarify and to close a gap:) Conversely, if there is an optimal graph with at most $n +k$ edges, then:

Each clause has to be on the tree, so it has to be connected to some literal. This costs $n$ edges.

For each variable $p$, either $p$ or $\lnot p$ has to be on the tree (because of $C_p$), so either $p$ or $\lnot p$ has to be connected (by an edge) to $s$ (because the distance has to be $1$). These connections cost $k$ edges.

So from each such pair EXACTLY one is connected with $s$. Those literals which are connected to $s$ now define a satisfying truth assignment.

Hence the instance $G,M$ of your problem that I constructed from the SAT problem $S$ has a solution of size at most $n+k$ iff $S$ is satisfiable. So any algorithm to solve your problem also solves SAT. Hence your problem is NP-complete.