输入样例:
6 2
1 2 3 4 5 6
输出样例:
5 6 1 2 3 4
# -*- coding: utf-8 -*-
import math
def right_shift(lst, m):
n = len(lst)
m = m % n
for j in range(math.gcd(m, n)):
temp = lst[j]
i = j
while (i - m) % n > j:
lst[i] = lst[(i - m) % n]
i = (i - m) % n
lst[i] = temp
return lst
if __name__ == '__main__':
input1 = list(map(int, (input()).split()))
input2 = list(map(int, (input()).split()))
print(' '.join(list(map(str, right_shift(input2, input1[1])))))