n, k = map(int, input().split()) s = input() t = s[:k-1] print(s[k-1:] + (t if (n-k+1)%2 == 0 else t[::-1]))