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