# coding: utf-8 N, K = map(int, input().split()) S = list(input()) if (N-K) % 2 == 0: ans = S[K-1:] + S[:K-1:-1] else: ans = S[K-1:] + S[:K-1] print("".join(ans))