An analogue of the binding polynomial for the case of ligands binding to an aggregating macromolecule