The chiral anomaly and a class of two-loop finite supersymmetric gauge theories