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