Efficient regime of electromagnetic emission in a plasma with counterstreaming electron beams