Photon-distribution effects on the dynamics of two nonidentical two-level atoms