[guided]A pair $(x_1,x_2)$ is bad if the two vertices have fewer than $L$ common neighbours in $Y$. We collect all such ordered pairs into
\begin{align*}
\mathcal B := \{(x_1,x_2) \in X \times X : |N_\Gamma(x_1) \cap N_\Gamma(x_2)| < L\}.
\end{align*}
The word “ordered” matters: $(x_1,x_2)$ and $(x_2,x_1)$ are counted separately unless $x_1=x_2$.
For a fixed bad ordered pair $(x_1,x_2) \in \mathcal B$, both vertices lie in $S$ precisely when every sampled vertex $Y_i$ is adjacent to both $x_1$ and $x_2$. That is, each $Y_i$ must lie in the common neighbourhood $N_\Gamma(x_1)\cap N_\Gamma(x_2)$. Define
\begin{align*}
J_{x_1,x_2}: \Omega &\to \{0,1\} \\
\omega &\mapsto \mathbb{1}_{\{x_1 \in S(\omega)\}}\mathbb{1}_{\{x_2 \in S(\omega)\}}.
\end{align*}
Then, using independence of $Y_1,\dots,Y_r$ and uniformity on $Y$,
\begin{align*}
\mathbb E[J_{x_1,x_2}]
=
\mathbb P(x_1 \in S \text{ and } x_2 \in S)
=
\left(\frac{|N_\Gamma(x_1)\cap N_\Gamma(x_2)|}{N}\right)^r.
\end{align*}
Because $(x_1,x_2)$ is bad, the numerator is strictly less than $L$, so
\begin{align*}
\mathbb E[J_{x_1,x_2}]
<
\left(\frac{L}{N}\right)^r.
\end{align*}
Now define the random variable
\begin{align*}
Z: \Omega &\to \mathbb N \cup \{0\} \\
\omega &\mapsto |\mathcal B \cap (S(\omega)\times S(\omega))|.
\end{align*}
This counts exactly the bad ordered pairs that survive inside $S(\omega)^2$. Since
\begin{align*}
Z = \sum_{(x_1,x_2)\in \mathcal B} J_{x_1,x_2},
\end{align*}
linearity of expectation gives
\begin{align*}
\mathbb E[Z]
=
\sum_{(x_1,x_2)\in \mathcal B}\mathbb E[J_{x_1,x_2}]
\leq
|\mathcal B|\left(\frac{L}{N}\right)^r.
\end{align*}
Finally, $\mathcal B \subset X\times X$, so $|\mathcal B|\leq M^2$. Hence
\begin{align*}
\mathbb E[Z]
\leq
M^2\left(\frac{L}{N}\right)^r.
\end{align*}[/guided]