What's the odd one out?
R, 16 bytes

T=a=1+!T;T=T-1;a

Try it online!
Works with \$n=1\$ and \$m=2\$.

Previous version:
R, 24 23 21 19 bytes
-4 bytes thanks to Dominic van Essen

T=a=1+0^T^2;T=T-1;a

Try it online!
Works with \$n=1\$ and \$m=2\$. This uses the fact that
\$0^k = \begin{cases} 1 &amp; \text{ if } k=0\\0&amp; \text { otherwise.}\end{cases}\$
Therefore, when the code is repeated \$k\$ times, we output \$1+0^{(2-k)^2}\$, which is worth \$2\$ when \$k=2\$, and \$1\$ otherwise.