When an order is placed 'at market' the order will be submitted as a market-to-limit order. This means the order will convert to a limit order once placed. For BUY orders the limit price will be set at the lowest offer. For SELL orders the limit price will be set at the highest bid.
Example: If the highest bidder for XYZ Limited is $13.20 and the lowest offer is $13.21. A BUY order placed 'at market' will be submitted as a 'market-to-limit' order with the limit price set at $13.21. A SELL order placed 'at market' will be submitted as a 'market-to-limit' order with the limit price set at $13.20.
If there are not enough shares to fill your order at the limit price set, the order will remain in the market as a partially filled order at the limit price it was submitted at. If you wish to transact the remaining shares you can either wait to see if your order fills at that limit price or amend your order as necessary.