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