def rotate(arr,n,k):
# write your code here
k = k % n
k = n - 1 - k
arr[:] = arr[k+1:] + arr[0:k+1]
#print(arr[0:k+1])
return arr
def main():
n=int(input())
arr=[]
for i in range(n):
val=int(input())
arr.append(val)
k=int(input())
arr = rotate(arr,n,k)
for i in range(n):
print(arr[i],end=" ")
main()