#include #include #include #include #define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i) #define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i) #define all(x) (x).begin(), (x).end() using namespace std; using ll = long long; template inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;} template inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;} int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; string S; cin >> N >> K >> S; string l = S.substr(K - 1, N - K + 1); string r = S.substr(0, K - 1); if ((N - K + 1) % 2) { reverse(all(r)); } cout << l << r << endl; return 0; }