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