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

S = input()

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