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