We’re only concerned with sets $A,B,X,Y$.
And it is given that $A \cup B = X \cup Y$.
So, we define a Universal Set $U = A \cup B = X \cup Y$ which contains all sets that we’re conderned with and nothing else.
Given – $|Y \setminus A| = |Y \cap A^c| = 2$ and $|A \setminus X| = |A \cap X^c| = |A \cap Y| = 4$.
Since, $(X \cap Y) = \phi$ and $(X \cup Y) = U$.
$Y = (Y \cap A) \cup (Y \cap A^c)$.
$\therefore |Y| = |(Y \cap A)| \cup |(Y \cap A^c)| = 4 + 2 = 6$.
Answer :- B.