Just going to start my PhD, found new professor with more exciting project, what to do?
Have you talked with Dr. B at all yet? You need to know if Dr. B would even be willing to take you on at all, and if so whether in a partial or full advisor situation, before raising the subject with Dr. A. If he wants to take on some or all of the duty of advising you, you can also ask Dr. B to advise you on the path to take with Dr. A.

There is not really a good way to say "Your subject is only second choice for me" and it could cool your relationship with Dr. A for a long time to come, so you should be sure that it is worth it before taking this step. Once you are ready to do it, and depending on the available choices, you could lay out the options to Dr. A and seek his input (would he agree to a shared project or not? and similar questions). His answers will then inform your final choice.