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