#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long int LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
signed main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < (int)(n); i++) s.push_back(s[n - i - 1]);
  vector<string> candidate;
  for (int i = 0; i < (int)(n); i++) candidate.push_back(s.substr(i, n));
  sort((candidate).begin(), (candidate).end());
  string opt = candidate[0];
  int i = 0;
  int l = 0;
  while (opt[i] == 'a') {
    l++;
    i++;
  }
  int r = pow(2, k - 1) * l;
  string ans;
  i = 0;
  while ((ans.size() < n) && (i < r)) {
    ans.push_back('a');
    i++;
  }
  i = 0;
  while ((ans.size() < n)) {
    ans.push_back(opt[l + i]);
    i++;
  }
  cout << ans << endl;
  return 0;
}
