Momentum on an Inclined Plane

A small block with mass m is sitting on a large block of mass M that is sloped so that the small block can slide down the larger block. There is no friction and no drag force. The center of mass of the smal block is located a height H above where it would be if it were sitting on the table and both blocks are started at rest.

Determine the initial velocity one should give the two blocks so that they would move together and precisely come to rest with the small block a height H above the ground.

Background questions that I'm wondering about:
1. Why is the total momentum of the system 0?
2. Why is momentum only conserved in the X direction?1. The problem statement, all variables and given/known data

Initially the small block is on the ground.
Some initial velocity is given both blocks, so they move towards each other, then the small block slides up on the slope and both of them come to rest when the small block is at height H.

There is no net horizontal force on the system, so the horizontal component of the momentum does not change. As it is zero at the end, initially it was zero, too.
You can not apply conservation of momentum in the vertical direction, as there is a net external force: gravity and normal force.

There are no horizontal forces from outside the system consisting of the two blocks. Once set in motion, the net horizontal momentum of the pair of blocks is therefore constant. Since the final state is for both to be at rest, that momentum must be 0.

2. Why is momentum only conserved in the X direction?

The upward force from the table is not constant. It therefore is not always equal to the gravitational force.