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