Create two block display of a view. The view should contain All content types. displays are
content type:Content Type A as filter criteria for
content type:Content Type B as filter criteria for
block_2 shows all of the nodes of
B. This link shows how to count number of results. Now the following code
<?php print views_embed_view('YourView','block_1');?>
<?php print views_embed_view('YourView','block_2');?>
outputs the number of results and you can format them in any way you want.