If you're determining that the both handlings denied obvious goal scoring opportunities, then you must caution the first and dismiss the second.
The Laws (Q&A, plus instruction actually) indicate that if a player commits DOGSO-H and then a second player scores "directly", then the offending player is only to be cautioned.
Taking that logic here and applying it to the situation at hand:
Attacker A shoots, Defender A commits DOGSO-H. Ball falls to Attacker B who shoots at goal, Defender B commits DOGSO-H.
At this point, you've now played "advantage" (whether you signalled it or not), and were the goal not denied by Defender B's handling, then you'd have the situation described above. So... dismiss Defender B, caution Defender A, penalty kick.