That is tricky because one of your conditions is to remove a group based on data from the subreport which does not have data returned until after the report is rendered.
Nothing is coming to mind how to fix that issue.
If you moved the subreport into the group header a and used a shared variable to flag the it as Hide or Show (0 or 1), suppress all of the items in the subreport, DO Not suppress the subreport but rather suppress if blank, move the headers to group header B, you could hide or show these based on the 1 or 0 rom the subreport in header A.