#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = 1234567;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int s_pow(int a, int b){
	if(b >= 20){
		return 10000;
	}else{
		return pow(a,b);
	}
}

int main(void){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	string s_;
	s_ = s;
	sort(all(s_));
	//cout<<s_<<endl;
	char waka = s_[0];

	int renzoku = 0;
	int count = 0;
	rep(i,s.size()){
		if(s[i] == waka){
			count++;
		}else{
			renzoku = max(renzoku, count);
			count = 0;
		}
	}
	if(count != 0){
		renzoku = max(renzoku, count * 2);
	}

	vector<int> kouho;
	vector<int> houkou;
	rep(i,s.size()){
		if(s[i] == waka){
			count = 0;
			int memo = i;
			while(i < s.size() && s[i] == waka){
				count++;
				i++;
			}
			if(i == s.size()){
				if(count*2 == renzoku){
					kouho.push_back(memo-1);
					houkou.push_back(-1);
				}
			}else{
				if(count == renzoku){
					if(k != 1){
						kouho.push_back(i);
						houkou.push_back(1);
					}
					if(k == 1){
						kouho.push_back(i);
						houkou.push_back(1);					
					}

				}
			}
		}
	}
	/*rep(i,kouho.size()){
		cout<<"kouho一覧"<<kouho[i]<<endl;
	}*/
	renzoku *= s_pow(2,k-1);

	if(renzoku >= n){
		rep(i,n){
			cout<<waka;
		}
		cout<<endl;
		return 0;
	}
	//cout<<renzoku<<endl;

	vector<string> ans_kouho;
	rep(i,kouho.size()){
		//cout<<"si:"<<kouho[i]<<"houkou"<<houkou[i]<<endl;
		int si = kouho[i];
		string moji = "";
		int count = 0;
		int nexti;


		if(houkou[i] > 0){
			while(moji.size() < n && si < s.size()){
				if(count < renzoku){
					moji.push_back(waka);
					count++;
					continue;
				}else{
					moji.push_back(s[si]);
					si++;
				}
			}
			si--;
			while(moji.size() < n && si >= 0){
				if(count < renzoku){
					moji.push_back(waka);
					count++;
					continue;
				}else{
					moji.push_back(s[si]);
					si--;
				}
				
			}
			if(moji.size() == n){
				ans_kouho.push_back(moji);
			}
		}else{
			string moji2 = "";

			si = kouho[i];
			while(moji2.size() < n && si >= 0){
				if(count < renzoku){
					moji2.push_back(waka);
					count++;
					continue;
				}else{
					moji2.push_back(s[si]);
					si--;
				}
				
			}
			si++;
			while(moji2.size() < n && si < n){
				if(count < renzoku){
					moji2.push_back(waka);
					count++;
					continue;
				}else{
					moji2.push_back(s[si]);
					si++;
				}
				
			}
			if(moji2.size() == n){
				ans_kouho.push_back(moji2);
			}
		}
		//cout<<ans_kouho[ans_kouho.size()-1]<<endl;
	}
	/*cout<<ans_kouho.size()<<endl;
	rep(i,ans_kouho.size()){
		cout<<ans_kouho[i]<<endl;
	}*/
	sort(all(ans_kouho));
	cout<<ans_kouho[0]<<endl;
	return 0;
}


Measured memory_bytes: 11904