N, K = map(int, input().split()) S = list(input()) ans = list(S[K-1:]) + S[0:K-1] if (N - K + 1) % 2 == 0 else list(reversed(S[0:K-1])) print(''.join(ans))