Distilling real-life into utilitarianism scenarios is fraught with reductionism - there are many factors that drive people's decisions and those all add up.
For me, it depends on the chances of "could save five lives" and the cost of the program.
If the chance of "could save 5" is under 20%, no, you don't divert the funds.
If the total expense of the program is over some threshold per life saved, and there is another opportunity, C, elsewhere to expend those funds with a better outcome (more lives saved/extended/improved), you defund both A & B in favor of that other program.
If you're e.g. making a change to road signage, you wouldn't start out with the total number of KSIs, you'd be looking at the potential reduction in KSIs. Similarly, if you're looking at a medical intervention, you'd be measuring a probability-adjusted delta in QALYs (in the UK).
The question specifically used certain language for one branch and uncertain language for the other, so I replied to the question as asked rather than strawmanning an answer to a question that wasn't asked.
Imagine you're an accountant working for the government. You choose how medical research funds are spent. One day, you notice that there are two equally expensive programs: Program A, which will save one life next year, and Program B, which could save five lives next year.
Program A is being funded, but Program B isn't. Program B could be funded if you took all of the funding from program A and diverted it.
Do you divert the funds?