You choose how the damage is divided as you cast the spell, not as it resolves. Each target must be assigned at least 1 damage.
2014-11-24 • wotc
If some but not all of Pyrotechnics’s targets become illegal, you can’t change the division of damage. Damage that would have been dealt to illegal targets simply isn’t dealt.
2014-11-24 • wotc
If an effect creates a copy of Pyrotechnics, the number of targets and division of damage can’t be changed. The effect that creates the copy may allow you to change the targets, however.