N,K = map(int,input().split()) s = "z" S = input() s += S #print(s) for i in range(N-K+1): #if i == 0: s = s[:i+1]+s[i+K:i:-1]+s[i+K+1:] #print(s) #else: # print(S[:i],S[i+K-1:0:-1]) # S = S[:i]+ S[i+K-1:i:-1]+S[i+K:] # print(S) print(s[1:])