n, k = map(int, input().split()) s = input() ans = s[k - 1:] if (n - k + 1) % 2 == 1: ans += s[:k - 1][::-1] else: ans += s[:k - 1] print(ans)