#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int n,k;
    string s;
    cin >> n >> k >> s;
    char sss = '{';
    rep(i,n){
        sss = min(sss,s[i]);
    }
    rep(i,k){
        string t = s;
        reverse(t.begin(),t.end());
        s += t;
        vector<string>v;
        string mi = "{";
        for(int i=0;i<n;i++){
            string p;
            for(int j=i;j<i+n;j++){
                p.push_back(s[j]);
            }
            
            mi = min(mi,p);
        }
        reverse(mi.begin(),mi.end());
        s = mi;
        bool flag = 1;
        rep(i,n){
            if(s[i]!=sss)flag = 0;

        }
        if(flag)break;
    }
    reverse(s.begin(),s.end());
    cout << s << endl;
    return 0;
}