We will use the results of Morphisms, Sections \ref{morphisms-section-nagata}, \ref{morphisms-section-dimension-formula}, and \ref{morphisms-section-normalization} without further mention. We may replace $Y$ by its normalization. Let $X_0 \to X$ be the normalization. The morphism $Y \to X$ factors through $X_0$. Thus we may assume that both $X$ and $Y$ are normal. \medskip\noindent Assume $X$ and $Y$ are normal. The morphism $f : Y \to X$ is an isomorphism over an open which contains every point of codimension $0$ and $1$ in $Y$ and every point of $Y$ over which the fibre is finite, see Varieties, Lemma \ref{varieties-lemma-modification-normal-iso-over-codimension-1}. Hence there is a finite set of closed points $T \subset X$ such that $f$ is an isomorphism over $X \setminus T$. For each $x \in T$ the fibre $Y_x$ is a proper geometrically connected scheme of dimension $1$ over $\kappa(x)$, see More on Morphisms, Lemma \ref{more-morphisms-lemma-geometrically-connected-fibres-towards-normal}. Thus $$ BadCurves(f) = \{C \subset Y\text{ closed} \mid \dim(C) = 1, f(C) = \text{a point}\} $$ is a finite set. We will prove the lemma by induction on the number of elements of $BadCurves(f)$. The base case is the case where $BadCurves(f)$ is empty, and in that case $f$ is an isomorphism. \medskip\noindent Fix $x \in T$. Let $X' \to X$ be the normalized blowup of $X$ at $x$ and let $Y'$ be the normalization of $Y \times_X X'$. Picture $$ \xymatrix{ Y' \ar[r]_{f'} \ar[d] & X' \ar[d] \\ Y \ar[r]^f & X } $$ Let $x' \in X'$ be a closed point lying over $x$ such that the fibre $Y'_{x'}$ has dimension $\geq 1$. Let $C' \subset Y'$ be an irreducible component of $Y'_{x'}$, i.e., $C' \in BadCurves(f')$. Since $Y' \to Y \times_X X'$ is finite we see that $C'$ must map to an irreducible component $C \subset Y_x$. If is clear that $C \in BadCurves(f)$. Since $Y' \to Y$ is birational and hence an isomorphism over points of codimension $1$ in $Y$, we see that we obtain an injective map $$ BadCurves(f') \longrightarrow BadCurves(f) $$ Thus it suffices to show that after a finite number of these normalized blowups we get rid at of at least one of the bad curves, i.e., the displayed map is not surjective. \medskip\noindent We will get rid of a bad curve using an argument due to Zariski. Pick $C \in BadCurves(f)$ lying over our $x$. Denote $\mathcal{O}_{Y, C}$ the local ring of $Y$ at the generic point of $C$. Choose an element $u \in \mathcal{O}_{X, C}$ whose image in the residue field $R(C)$ is transcendental over $\kappa(x)$ (we can do this because $R(C)$ has transcendence degree $1$ over $\kappa(x)$ by Varieties, Lemma \ref{varieties-lemma-dimension-locally-algebraic}). We can write $u = a/b$ with $a, b \in \mathcal{O}_{X, x}$ as $\mathcal{O}_{Y, C}$ and $\mathcal{O}_{X, x}$ have the same fraction fields. By our choice of $u$ it must be the case that $a, b \in \mathfrak m_x$. Hence $$ N_{u, a, b} = \min \{\text{ord}_{\mathcal{O}_{Y, C}}(a), \text{ord}_{\mathcal{O}_{Y, C}}(b)\} > 0 $$ Thus we can do descending induction on this integer. Let $X' \to X$ be the normalized blowing up of $x$ and let $Y'$ be the normalization of $X' \times_X Y$ as above. We will show that if $C$ is the image of some bad curve $C' \subset Y'$ lying over $x' \in X'$, then there exists a choice of $a', b' \mathcal{O}_{X', x'}$ such that $N_{u, a', b'} < N_{u, a, b}$. This will finish the proof. Namely, since $X' \to X$ factors through the blowing up, we see that there exists a nonzero element $d \in \mathfrak m_{x'}$ such that $a = a' d$ and $b = b' d$ (namely, take $d$ to be the local equation for the exceptional divisor of the blowup). Since $Y' \to Y$ is an isomorphism over an open containing the generic point of $C$ (seen above) we see that $\mathcal{O}_{Y', C'} = \mathcal{O}_{Y, C}$. Hence $$ \text{ord}_{\mathcal{O}_{Y, C}}(a) = \text{ord}_{\mathcal{O}_{Y', C'}}(a' d) = \text{ord}_{\mathcal{O}_{Y', C'}}(a') + \text{ord}_{\mathcal{O}_{Y', C'}}(d) > \text{ord}_{\mathcal{O}_{Y', C'}}(a') $$ Similarly for $b$ and the proof is complete.