Showing the integral of a function is finite almost everywhere Suppose$\ E \subset \mathbb R$ is closed. Let$\ d(y) = \inf \{|x-y| : x \in E \} $ and let $\ M(x) = \int_0^1\frac{d^a(y)}{|x-y|^{(1+a)}} dy $ , for some arbitrary constant $a$.
Show that $\ M(x)$ is finite everywhere in $E$ except on a set of measure zero. We are given the hint to integrate$\ M(x)$ over $E$.
I had the idea to use Fubini's Theorem to interchange the order of the integrals, obtaining 
$$\int_E \int_0^1\frac{d^a(y)}{|x-y|^{(1+a)}} \,dydx = \int_0^1\int_E\frac{d^a(y)}{|x-y|^{(1+a)}} \,dxdy $$
in hoping this would allow us to simplify the expression or obtain some new information, but I'm unsure how to continue or if this is even the right way to approach the problem.

First of all, observe that it is enough to extend the $y$ integration over $(0,1)\cap E^c$ only because $d(y)=0$ on $E$. Also, since this set is open, I can write it as a disjoint union of open intervals $I_n$, and $M(x)=\sum \int_{I_n} d^a(y)/|x-y|^{1+a}\, dy$.
Now let's look at $\int_E M(x)\, dx$ (as you already did above), and consider the contribution coming from a fixed interval $y\in I_n=I=(c,d)$ to this. By Fubini, this is bounded by
$$
\int_c^d dy\, d^a(y) \int_{(0,1)\setminus (c,d)} \frac{dx}{|x-y|^{1+a}} .\quad\quad\quad\quad (1)
$$
We can evaluate the $x$ integral. This will be $\lesssim \max\{ (y-c)^{-a}, (d-y)^{-a}\}= d^{-a}(y)$; the equality holds because $(c,d)$ is a component of $E^c$, so $c,d\in E$ (unless $c=0$ or $d=1$). Thus (1) is $\lesssim d-c$ and since our intervals are disjoint and contained in $(0,1)$, we conclude that $\int_E M(x)\, dx <\infty$, as desired.
