Suppose that X and Y are discrete random variables with a joint probability

mass function p_XY (x, y).

Procedure is the following:

a. Generate X ∼ p_X (x).

b. Accept X with probability p(y|X).

c. If X is accepted, terminate and return X. Otherwise go to Step a.

Show that this procedure generates a random variable X ∼ p_X|Y (x|y).

I would've been grateful for any help. Tnx