N, K = map(int, input().split())
S = input()

if (N - K) % 2 == 0:
    print(S[K-1:] + ''.join(reversed(S[:K-1])))
else:
    print(S[K-1:] + S[:K-1])