We want to count out the 3 reds from the left hand side, which we do with a 3 bit register set to 2, so the third red triggers the right hand side. The 3 bit register on the right hand side counts out the first 7 balls, with the last one retriggering the left hand side. The register on the left hand side is now reset to 7, so all the remaining balls are released.
Link: jstumble