Having said that,
mV + M0 = (m + M)v; where m = bullet mass, M = block mass, V = bullet velocity upon incoming, and v = the block and bullet velocity (ideal without losses) is the answer you are looking for. Thus, v = V(m/(m + M)) is what you want. m = Mb, M = Mw, and V = Vi.