#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n,k;
    string s;
    cin>>n>>k>>s;
    k = min(k, 20);
    rep(_,k-1){
        string t = s;
        reverse(t.begin(),t.end());
        s += t;
        reverse(s.begin(),s.end());
        string mi = "{";
        rep(i,n+1){
            mi=min(mi,s.substr(i,n));
        }
        s = mi;
        reverse(s.begin(),s.end());
    }
    string t = s;
    reverse(t.begin(),t.end());
    s += t;
    string mi = "{";
    rep(i,n+1){
        mi=min(mi,s.substr(i,n));
    }
    cout<<mi<<endl;
    return 0;
}