N, K = map(int, input().split()) S = input() t = S[K - 1:] if (N - K) % 2: t += S[:K - 1] else: t += S[K - 2::-1] print(t)