Read the code to see what values those variables hold.
What is in m?
What is in flag?
In what conditions are they given values?