Two-frequency undulator and harmonic generation by an ultrarelativistic electron