I have a script that inserts Master B every other page, but it doesn't look like a can post a .jsx file here. I don't know the first thing about creating scripts, but here's the text if I open it in Notepad. I'm not sure if that helps, maybe someone else can provide better direction.
var myPages = app.activeDocument.pages.length;
var ad = app.activeDocument;
for (var i = myPages-1; i>=0; i-- )
{
var myPage = ad.pages.add(LocationOptions.AFTER, ad.pages);
myPage.appliedMaster= ad.masterSpreads.item('B-Master');
}