I think "m and M" might be clearer than "m1 and m2."
There are no external horizontal forces applied, so horizontal momentum is conserved. For the ramp of mass M,
p = 0 = m*4.00m/s - M*V
giving V a positive sign. So
V = 4m/s * m / M
Since there is no friction, energy is also conserved, so the block's initial PE becomes KE in the two objects:
m*g*h = ½(m*(4.00m/s)² + M*(4m/s * m/M)²)
m * 9.8m/s² * 5m = m*8m²/s² + 8m²/s² * m²/M → divide by m
49m²/s² = 8m²/s² + 8m²/s² * m/M
m/M = 41m²/s² / 8m²/s² = 5.125
M = m / 5.125
For a block of doubled mass, our conservation of momentum equation becomes
p = 0 = 2m*v - (m/5.125)*V
which rearranges to
V = 10.25v
and so our conservation of energy equation becomes
2m*g*h = ½(2m*v² + (m/5.125)*(10.25v)²) = mv² + 10.25mv² → m cancels
2*g*h = 11.25v²
g*h = 5.625v²
so
v² = g*h / 5.625 = 49m²/s² / 5.625 = 8.71 m²/s²
v = 2.95 m/s ◄
Check:
for the block of mass m, V = 4m/s * 5.125 = 20.5 m/s
for a total KE = ½(m*4² + (m/5.125)(20.5)²) = 49m J → for m in kg
for the block of mass 2m, V = 10.25 * 2.95m/s = 30.25 m/s
and the total KE = ½(2m*(2.95)² + (m/5.125)(30.25)²) = 98m J → for m in kg
and we have in fact finished with twice the KE (which is good, since we finished with twice the starting PE).
Hope this helps!