n,k=map(int,input().split()) s=input() print([s[k-1:]+"".join(reversed(list(s[:k-1]))), s[k-1:]+s[:k-1]][(n-k)%2])