N, K = map(int, input().split()) S = input() for i in range(len(S)): if i+K-1 < len(S): S = list(S) S[i], S[i+K-1] = S[i+K-1], S[i] print(''.join(S))