Confusion about Collateral for Delivery Margin

Is there an order of debit? Or will you sell pledged stocks at random?