Modeling network output order

I have a network with two softmax output arrays A and B, for each of which I find the max. My problem has the constraint that max array B >= max array A. At the moment, I account for this by replacing a value in B that doesn’t meet the constraint with the value of A. However, I’m wondering if this could be modeled in the network or in the loss, eg by adding an additional loss term driving up the total loss if the constraint is violated.

Ideas or pointers would be appreciated. Thanks!