n,k = map(int,input().split()) s = input() if n-k+1 % 2 == 0: for i in range(n): print(s[(k+i-1)%n],end='') else: for i in range(n): if i <= n-k: print(s[(k+i-1)%n],end='') else: print(s[n-i-1],end='')