# Question about adjunction formula $K_Y = (K_X + Y)|_Y$

I've learnt that if $$Y\subset X$$ is a smooth subvariety of codimension 1 then the degree of canonical divisors of $$Y$$ and $$X$$ are related by

$$$$\deg K_Y = \deg((K_X + Y)\cap Y).$$$$

$$$$K_Y = (K_X + Y)|_Y$$$$
$$$$K_Y = (K_X + Y)\cap Y ?$$$$
Where $$\cap$$ is an intersection product and both sides are equal as divisor classes in $$Div(Y)$$.
We also know that if $$i:Y\rightarrow X$$ is an inclusion then $$\mathcal{O}_Y(K_Y) = i^*(\mathcal{O}_X(K_X)\otimes \mathcal{O}_X(Y))$$. I naively would think that by taking chern class on both sides, we have \begin{align} K_Y &= c_1(\mathcal{O}_Y(K_Y)) = c_1(i^*(\mathcal{O}_X(K_X)\otimes \mathcal{O}_X(Y)))\\ &= i^{-1}c_1(\mathcal{O}_X(K_X)\otimes \mathcal{O}_X(Y)) \\ &= i^{-1}(K_X + Y) \\ &= (K_X + Y)\cap Y \end{align}