# 题目

**输入格式：**每个输入包含一个测试用例，第1行输入N (1<=N<=100)、M（M>=0）；第2行输入N个整数，之间用空格分隔。

**输出格式：**在一行中输出循环右移M位以后的整数序列，之间用空格分隔，序列结尾不能有多余空格。

6 2
1 2 3 4 5 6

5 6 1 2 3 4

# 代码

## C++解法

```#include <iostream>
using namespace std;

const int maxn = 105;
int a[maxn];

int main() {
int n, m;
cin >> n >> m;
m %= n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i < n; ++i) {
if (i)
cout << " ";
cout << a[(i - m + n) % n];
}
cout << endl;
return 0;
}
```

## Python解法

```(n, m) = input().split()
a = input().split(' ')
n = int(n)
m = int(m) % n
print(" ".join([a[i - m] for i in range(n)]))

```

## Java解法

```import java.util.*;

class Main {
public static final int maxn = 105;
public static int[] a = new int[maxn];

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt() % n;
for (int i = 0; i < n; ++i) {
a[i] = in.nextInt();
}
for (int i = 0; i < n; ++i) {
if (i > 0) {
System.out.print(" ");
}
System.out.print(a[(i + n - m) % n]);
}
System.out.print("\n");

in.close();
}
}
```