#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<pair<int,int>>>;
#define INF 1000000000000000000
#define MOD 1000000007

int main(){
  int N,K;
  string S;
  cin>>N>>K>>S;

  for(int i=K-1;i<N;i++){
    cout<<S.at(i);
  }
  if((N-K)%2==1){
    for(int i=0;i<K-1;i++){
      cout<<S.at(i);
    }
  }else{
    for(int i=K-2;i>=0;i--){
      cout<<S.at(i);
    }
  }
  cout<<endl;
}