If that master layer is at the bottom of layers you can get his index like this:
var bottomLayerIndex = myComp.layer(myComp.layers.length).index;
If that layer have a concrete name:
var bottomLayerIndex = myComp.layers.byName(yourMasterLayerName).index;
Then you can push it into the array:
layerIndices.push(bottomLayerIndex);