Galvanometer does not show any deflection. Hence no current is flowing from 2V battery. This is possible only if potential difference beteen points A and B are 2V. Hence potential difference across 500Ω resistor is 10 V.
Hence current flowing through 500Ω resistor is 10/500 = 20mA.
Same 20 mA will flow through resistance R. Hence resistance value of R = 2/0.02 = 100Ω.