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