n,k = map(int,input().split()) s = list(input()) for i in range(1,n-k+2): s[i-1:i+k-1] = s[i-1:i+k-1][::-1] print("".join(s))