Let the people go
I think you should let your two players leave unmolested, and to leave nothing for the remaining players.
After the next section, I will proceed to justify this position in the rest of the post.
When the remaining players complain
If the remaining players complain about losing the loot, I would point out that they still have more than 83% of their loot and fighting power remaining, and that their actions directly lead to these players leaving.
If they continue complaining, I would offer them a quest where they can get equivalent loot and swords elsewhere.
If they continue complaining that they want to fight the actual characters who actually left, then I'd ask if the players wanted to do this out of spite the leaving players.
If they respond that they are not, but that they still want to fight the exact characters that left, I would put on my evil GM grin, and ask them if they are sure. Twice.
"Are you sure?" are the most ominous words a GM can ever use.
If they are sure, then I'd allow them to hear rumors of someone who can retrieve anyone. Drop lots of ominous hints. Lead them to some representative of chaotic evil powers. Make a dark deal for bonus points. One of their souls. A bit of soul from each of them. The soul of a child. Their memories of a skill. Their memories of childhood.
Then let them summon exact parallel universe twins of the characters. Let the twins recognize what is summoning them and to prepare for a fight.
Then play the fight straight.
Try to kill at least one of the remaining player characters. Remind them that they asked for this. Repeatedly. And that you checked that they were sure. Twice. And that they didn't want an equivalent quest.
But that's just me. I get a bit fire and brimstone when people are being dicks.
You are a judge
As a GM, you cannot please everyone all of the time. You have to interpret the rules and the situation, and use your judgement to make a fair and consistent ruling. If you can't make the ruling fair and consistent, try to make it appear to be fair and consistent.
I try to handle judgement situations by trying to figure out which roleplaying principles are relevant to the situation, and how they apply. That way I can explain my decision in terms that players can perceive as fair and consistent.
My understanding of roleplaying game theory is that there are three main ways to play: Narrativist, gamist and simulationist.
The Narrativist perspective
Narrativist gaming is about developing character motivations, and often players have strong control over their character's behavior.
- If the remaining characters suddenly murder two of their companions for their loot, then that should be directly informed by their character motives, and then they need to follow through, by always looking for an opportunity to murder more of the player characters.
- The leaving players have player agency. They have a right to say what their characters do, and if they say that their characters walk away, then the remaining players have no right to dispute that.
The Gamist perspective
Gamist play is actually not about collecting loot, but about overcoming greater and greater challenges.
- As a GM, you choose how difficult to make their challenges. You can choose to adjust the difficulty of challenges to account for the smaller group.
- If the remaining players want to overcome a challenge to be better prepared for the next challenge, then they can choose to fight something other than the leaving players. They don't have to take the players on for their loot. They can get the same loot from a different fight.
- If the remaining players want to get the loot without a fight, then I would point out that they are betraying the goal of gamist playing. If you give them a "always win" cheat code, what would be the fun of playing at all?
The Simulationist perspective
Mostly concerned with internal consistency, and cause and effect.
- The remaining PCs have no in-game way of knowing that the leaving players want to leave.
- If they decided to fight the leaving PCs, then they're going up against powerful characters that may kill some of them in a fair fight.