#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;
  string candidate = s;
  for (int i = 0; i < (int)(n); i++) s.push_back(s[n - i - 1]);
  int l = 0;
  int cnt = 0;
  for (int i = 0; i < (int)(2 * n); i++) {
    if (s[i] == 'a') cnt++;
    l = max(l, cnt);
    if (s[i] != 'a') cnt = 0;
  }
  int r = pow(2, k - 1) * l;
  if (r >= n) {
    for (int i = 0; i < (int)(n); i++) cout << 'a';
    cout << endl;
    return 0;
  }
  for (int i = 0; i < (int)(2 * n - r); i++) {
    candidate = min(candidate, s.substr(i, n));
  }
  for (int i = 0; i < (int)(r); i++) cout << 'a';
  cout << candidate.substr(l, n - r) << endl;
  return 0;
}
