def solution(A, K):
array_len = len(A)
P = K
new_list = []
for number in A:
K = P
number_index = A.index(number)
while K > 0:
number_index = number_index + 1
upper_limit = array_len - 1
if number_index > upper_limit:
number_index = 0
K = K - 1
A[A.index(number)] = '-'
new_list.insert(number_index,number)
return new_list