N,K=map(int,input().split()) S=input() ans=S[K-1:] if (N-K)%2 == 1: ans+=S[:K-1] else: ans+=S[:K-1][::-1] print(ans)