Here's the question, basically I'm not sure how to bridge the two parts together. Thanks for any and all help!

Two biased coins have the same probability p of coming up Heads. The first coin is tossed until Heads appears for the first time, let N be the number of tosses. The second coin is then tossed N times. Let X be the number of times the second coin comes up Heads. Find the pmf (probability mass function) of X (express the pmf by writing P (X = k) as an infinite series).

So I know that the pmf of the first part of the problem, the first coin being tossed until H appears, is:

P(X=N) = [(1 - p)^(N-1)]p

I'm having trouble bridging the first pmf with the second pmf. My thinking is that P(N) above is now the probability that the second coin's toss would come up heads , but I'm lost beyond that. I also don't understand how this can be written as an infinite series if we're limiting the amount of throws of the second coin to be N. Any and all help will be greatly appreciated!