#include using namespace std; int main() { int N, K; string S; cin >> N >> K >> S; string s1 = S.substr( 0, K - 1 ); string s2 = S.substr( K - 1 ); if( (N - K + 1) % 2 ) reverse( s1.begin(), s1.end() ); S = s2 + s1; cout << S << endl; }