During 1-Cannon, collect the 8 red coins to put a gold flower into your reserve. Then, instead of getting the normal exit in M-1, get the secret exit along with coins 1 and 3. Don’t get coin 2 since this coin requires gold flower which will replace your tanooki suit. After M-1 secret, go to M-A and use the gold flower there. This speeds up the level by about 5 seconds. M-A gold flower strats can be seen in Juice’s All Castles WR. After M-A, go back to M-1 and get the normal exit along with the second coin. You should finish the level as Fire Mario with a leaf in reserve. Do M-2 as Fire Mario and damage boost through the urchin at the end. Equip your reserve leaf in the room with coin 3. From here, the route is the same as before until your second visit to World M, where you can skip M-1 secret and M-A, since you already did them, and take the faster overworld path to M-3 and continue as normal.
Just watch how Juice does M-A in the AC wr. That’s really all you need to see.