Python:
a = int(input())
b = input()
c = input()
def de(a, b, c):
bb = [int(i) for i in b.split()]
cc = [int(i) for i in c.split()]
bb.append(cc[0])
for i in range(a-cc[1]+1):
bb[a], bb[a-1] = bb[a-1], bb[a]
a -= 1
print (bb)
bb = [str(i) for i in bb()]
print(' '.join(bb))
de(a, b, c)