Josephus ring: Input M and N, count from 1 to N circularly. Output a number when it goes to M every time.