n = int(input()) a = input().split() x = int(input()) last = a.pop() a.insert(x-1,last) print(" ".join(a))