Current through the circuit
I = 2E/(R+r1+r2)
Potential drop V1 across the first cell,
V1 = E - Ir1
Potential drop V2 across the first cell,
V2 = E - Ir2
For the potential drop V1 across first cell to be zero,
V1 = E - Ir1 = 0
E = Ir1
I = E/r1
E/r1 = 2E/(R+r1+r2)
Transposing and solving,
R = r1 - r2
So if R = r1 - r2, the potential drop across the cell E1 with internal resistance r1 will be zero.