//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;
 
using namespace std;
 
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;
 
const int N = 2e5 + 123;
int n , m, k , x;
string s;
int a[N];
int dp[N][5];
bool cmp1(int i , int j){
	return s.substr(i,x) < s.substr(j,x);
}
bool cmp(int i , int j){
	string h = s.substr(i,x) , t = s.substr(j,x);
	reverse(all(t));
	reverse(all(h));
	return h < t;
}
string findmin(){
	string h = s;
	reverse(all(h));
	s = s + h;
	vector < int > v;
//	cout << s << ' ';
	for(int i = 0 ; i + n - 1 < sz(s);i++){
		v.pb(i);
	}
	x = n;
	return s.substr(*min_element(all(v) , cmp1),n);
}
main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> n >> k;
	cin >> s;
	if(k >= n){
		sort(all(s));
		while(n--)
			cout << s[0];		
	    return 0;
	}
	char ch = 'z';
	for(int i = 0 ; i < sz(s) ; i++)
		ch = min(ch , s[i]);

	while(1){
		k--;
		if(k == 0)ret(findmin());
		vector < int > best;
		int tmp = 0 , cnt = 0;
		string h = s;
		reverse(all(h));
		 s += h;
		for(int i = 0 ; i < sz(s) ; i++){
			if(ch != s[i]){
				if(cnt > tmp)
					best.clear();
				tmp = max(cnt , tmp);
				if(cnt == tmp&& i - n >= 0)
					best.pb(i - n);	
			}
			else 
				cnt++;
		}
		if(cnt > tmp)
			best.clear();
		tmp = max(cnt , tmp);
		if(cnt == tmp)
			best.pb(sz(s) - n);
		x = n;
//		cout << *min_element(all(best) , cmp) << ' ';
		s = s.substr(*min_element(all(best) , cmp) , n);
	}

//	cout << dp[n][1] << ' ' << dp[n][2] << ' ';
}