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