def rev(s): return s[::-1] N, K = map(int, input().split()) K -= 1 S = list(input().rstrip()) d = N - K if d % 2: ans = S[K:] + rev(S[:K]) else: ans = S[K:] + S[:K] print(*ans, sep="")