Use equation Ek = 0.5mv^2
where m is the mass of the object that is moving and v is it's velocity and Ek is it's kinetic energy.
Let's call the 500kg mass 'A'
And the 2000kg mass 'B'
Rearrange the kinetic energy equation above to make v the subject:
mv^2 = 2Ek
v^2 = 2Ek/m
v = sqrt(2Ek/m)
For object A:
v = sqrt(2Ek(A)/500)
v = sqrt(Ek(A)/250)
For object B:
v = sqrt(2Ek(B)/2000)
v = sqrt(Ek(B)/1000)
Both objects have equal velocity therefore their equations can be equated:
sqrt(Ek(A)/250) = sqrt(Ek(B)/1000)
Rearrange for Ek(B) / Ek(A) :
Ek(A)/250 = Ek(B)/1000
Ek(A) = Ek(B)/4
Ek(A) / Ek(B) = 1/4
Therefore Ek(B) / Ek(A) = 4
4 is the answer.