N,K=map(int,input().split()) S=list(input()) """ s=[0]*N for i in range(0,N-K+1): for k, c in enumerate(reversed(list(S[i:i+K]))): S[i+k] = c s[i+k] += 1 print(S) print(s) """ shift = max(K-1,0) # print(shift) a="".join(S[shift:]) + "".join(list(reversed(S[:shift]))) print(a)