#include <stdio.h> #include <stdlib.h> #define N 100 int data[N]; void f(int m, int n) { int i, j, k; for(i = 0; i < n; i++) data[i] = i+1; j = n,i = 0; while(1) { k = m; while(1) { if(data[i]) k--; if(k == 0) { printf("%d/t",data[i]); data[i] = 0; j--; break; } i = (i+1)%n; } if(j == 0) break; while(data[i] == 0) i = (i+1)%n; } return ; } int main() { int m, n; scanf("%d %d", &m, &n); f(m, n); return 0; }