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