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