Energy principle for excitations in plasmas with counterstreaming electron flows