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