Level 2-6 (Mario vs. Donkey Kong: Tipping Stars)
From the Super Mario Wiki, the Mario encyclopedia
The M Coin stands on a platform located high in the course. To reach it, the Minis should first be shot upward out of the Cannon at the bottom, then bounced off a High Spring and helped with some Red Girders to avoid a pit of spikes. They soon encounter a wall and turn around, heading into the coin.
Nintendo 3DS version
Wii U version