n, k = map(int, input().split())

s = input()
rev = 1 if n - k % 2 else -1
print(s[(k - 1) :] + s[: k - 1][::rev])