#nithish 
num1,num2 = map(int,input().split(" "))
num = list(map(int,input().split(" ")))
for i in range(0,num2):
	num = [num[-1]] + num[:-1]
print(' '.join(map(str,num)))

79b68c029b44c5e92e4293c55493b4c2f2c46dc5
<mask token>

<mask token>
for i in range(0, num2):
    num = [num[-1]] + num[:-1]
print(' '.join(map(str, num)))

num1, num2 = map(int, input().split(' '))
num = list(map(int, input().split(' ')))
for i in range(0, num2):
    num = [num[-1]] + num[:-1]
print(' '.join(map(str, num)))

#nithish 
num1,num2 = map(int,input().split(" "))
num = list(map(int,input().split(" ")))
for i in range(0,num2):
	num = [num[-1]] + num[:-1]
print(' '.join(map(str,num)))
