Probability of a selected coin having one head and one tail

I am preparing for my probability class next semester. There is a question on Bayes Theorem that I can't seem to understand.

A box has N coins such that X of these coins have two heads, Y have one head and one tail, and N = X + Y. A coin is randomly chosen and flipped, and it comes up heads. What is the probability that the selected coin has one head and one tail.

My attempt is, of course, to use Bayes theorem based on this example. However, there are X and Y coins, instead of 2 coins as in the example. How can I determine a probability of head? Would it be $$\left(\frac{1}{2}\right)^Y$$ for the fair coin, and $$1^X$$ for double headed coin?

Any help or suggestion is appreciated. Thanks all!

You can think of it like this:

We are not looking at coins but at sides of coins.

Among the $2N=2X+2Y$ sides there are $2X+Y$ heads and among these heads there are $Y$ having a tail as mate (i.e. the other side of the coin that shows this head is a tail).

So if you select some head (comparable with flipping a coin that comes up with a head, because all heads have equal chances to be this elected head) then the probability that its mate is a tail will equalize:$$\frac{Y}{2X+Y}$$

edit (for if you insist on using Bayes rule).

Let $E$ be the event that the selected coin has one head and one tail, and let $H$ denote the event that by flipping the selected coin a head shows up.

Then be found is $P(E\mid H)$ and the following equalities enable you to do that:$$P(E\mid H)P(H)=P(H\mid E)P(E)\tag1$$and:$$P(H)=P(H\mid E)P(E)+P(H\mid E^{\complement})P(E^{\complement})\tag2$$

This because $P(H\mid E)$, $P(H\mid E^{\complement})$, $P(E)$ and $P(E^{\complement})$ are not difficult to find.

Give it a try yourself.

See the following diagram ("HT" is "the coin has a head and a tail", "2H" is "the coin has two heads"). Now

$$P(HT|H)=\frac{P(H|HT)P(HT)}{P(H|HT)P(HT)+P(H|\overline{HT})P(\overline{HT})}\\=\frac{\frac12\frac YN}{\frac12\frac YN+1\frac XN}=\frac{Y}{Y+2X}$$