x=input N,K=map(int,x().split()) S=x() print(S[K-1:]+S[:K-1][::(-1)**(N-K+1)])