Step 1: Recall how an ideal diode behaves.
An ideal diode is just a smart switch. When its p-side sits at a higher potential than its n-side (forward bias), it closes and behaves like a plain wire with no resistance. When the n-side is higher (reverse bias), it opens and stops the current completely.
Step 2: Set the strategy.
For each circuit, first decide whether the diode is forward biased, then apply Ohm's law $I = V/R$ across the resistor using the net driving voltage.
Step 3: Analyse circuit X.
Here the diode's p-side is at $+4\ \text{V}$ and its n-side reaches ground ($0\ \text{V}$) through a $2\ \Omega$ resistor. Since $4\ \text{V} > 0\ \text{V}$, the diode is forward biased and conducts as a wire.
Step 4: Compute the current in X.
The full $4\ \text{V}$ appears across the $2\ \Omega$ resistor: $$I_X = \frac{4}{2} = 2\ \text{A}.$$
Step 5: Analyse circuit Y.
A $+4\ \text{V}$ source feeds the p-side through a $2\ \Omega$ resistor, while the n-side is held at $+2\ \text{V}$. Since $4\ \text{V} > 2\ \text{V}$, the diode is again forward biased, but the effective voltage across the resistor is only the difference.
Step 6: Compute the current in Y.
$$I_Y = \frac{4 - 2}{2} = \frac{2}{2} = 1\ \text{A}.$$ So the two currents are $2\ \text{A}$ and $1\ \text{A}$.
\[ \boxed{I_X = 2\ \text{A},\ I_Y = 1\ \text{A}} \]