It is legal in Islam for a man to marry more than one woman.
فانكحوا ما طاب لكم من النساء مثنى وثلاث ورباع
Then marry those that please you of [other] women, two or three or four.
— Quran 4:3
If the ...
This is considered cheating and deception in Islam, they are forbidden and are characteristics of hypocrites. And both are heinous sins.
Your example scenario (rephrased):
If we suppose that X and Y ...