This requires a snippet in functions.php of your child theme.
Change Products (OR) to Products (AND) and add this snippet:
add_filter( 'woocommerce_coupon_is_valid_for_product', function( $valid, $product, $coupon, $values ) {
$my_item_id = 123; // ID OF PRODUCT B
$my_coupon_code = 'the-code-of-the-coupon';
if ( $coupon->get_code() === $my_coupon_code ) {
return $product->get_id() == $my_item_id;
}
return $valid;
}, 10, 4 );
Replace 123 with the id of product B and replace the-code-of-the-coupon with the actual coupon code.