m is overflowing after 32 loops because its declared as an int. The largest signed integer value is +32,767 so m goes negative at the point when 1000 is addeded to 32000.When that happens, the statement (m <= millis()) is false and after that m is never incremented.
Declaring m as a long will solve the problem, declaring it as an unsigned long is even better.
Its not stupid at all. If my personal experience is anything to go by, it happens all the time
Almost every bug I have ever found in my code (and that is a number so big it would probably also overflow an int) has seemed like a trivial mistake once I had found it, even if it took me days to track down. I do keep telling myself to take more care coding to avoid this kind of thing, but it still happens frequently enough that I have learned to look for 'stupid' mistakes first in my code when my programs misbehave.