By throwing the bag in one direction, we gain some velocity in the opposite direction as per the law of conservation of linear momentum. In this way we can come out of the ice easily.