You get the blue key, which lets you press 2 to scale Y. Then use that to get the red (X scale) key on the left, then use both to get the green key in the pit on the right, which lets you change the mass of the block blocking the exit.
Which part specifically did you get stuck on, so I can avoid a similar situation in any future games.