When you apply to allopathic medical schools, you will report both grades on your transcript and AMCAS will average them into your bcpm/cum.
If you decide to apply to apply to osteopathic medical schools as well, then you will report both grades but indicate the 2nd as a retake. AACOMAS will replace your original grade with the latest grade so you can turn that D into an A. Both grades will show on the transcript, but only the A will be counted towards bcpm/cum. hope this helps clear things up.