int main() { int n; int move_bits; scanf("%d %d", &n, &move_bits); int* A = (int*)malloc(n * sizeof(int)); for ( int i = 0; i < n; i++ ) { scanf("%d", &A[i]); } if ( move_bits > n ) { move_bits -= n; } int flag = n - move_bits - 1; for ( flag; flag >= 0; flag-- ) { int tmp_flag = flag; for ( tmp_flag; tmp_flag - flag < move_bits; tmp_flag++ ) { int t; t = A[tmp_flag]; A[tmp_flag] = A[tmp_flag + 1]; A[tmp_flag + 1] = t; } } for ( int i = 0; i < n; i++) { if ( i == n - 1 ) { printf("%d", A[i]); } else { printf("%d ", A[i]); } } return 0; }