import copy N,K = map(int,input().split()) S = list(input()) ans = copy.deepcopy(S) for i in range(N): ans[i] = S[(i+K-1)%N] print(*ans,sep='')