#include #define rep(i,n) for (int i=0; i<(int)(n); i++) using namespace std; using ll = long long; using P = pair; int main() { int n, k; cin >> n >> k; string s; cin >> s; string ls = s.substr(k-1,n); string rs = s.substr(0, k-2); if ((n-k+1)%2 == 0) reverse(rs.begin(), rs.end()); cout << ls << rs << endl; }