#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
inline void myassert(bool a, string s) {
  if (!a) cerr << s << endl, exit(0);
}
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return ~f ? s : -s;
}
const int maxn = 5e3 + 20;
int n, k;
char str[maxn];
char mn;
int len;
inline string solve(int l, int r) {
  string s;
  int len = r - l + 1;
  for (int i = (1), _end_ = (len << k - 1); i <= _end_; i++) s += mn;
  for (int i = (r + 1), _end_ = (n); i <= _end_; i++)
    if (((int)s.size()) < n) s += str[i];
  for (int i = (n), _end_ = (1); i >= _end_; i--)
    if (((int)s.size()) < n) s += str[i];
  return s;
}
inline string solve1(int l, int r) {
  string s;
  int len = r - l + 1;
  for (int i = (1), _end_ = (len << k); i <= _end_; i++) s += mn;
  for (int i = (l - 1), _end_ = (1); i >= _end_; i--)
    if (((int)s.size()) < n) s += str[i];
  return s;
}
inline void init() {
  n = read();
  k = read();
  scanf("%s", str + 1);
  mn = 'z' + 1;
  for (int i = (1), _end_ = (n); i <= _end_; i++) chkmin(mn, str[i]);
  if (k > 20) {
    for (int i = (1), _end_ = (n); i <= _end_; i++) putchar(mn);
    exit(0);
  }
  int slen = 0, lstlen = 0;
  for (int i = (1), _end_ = (n); i <= _end_; i++) {
    if (i == n || str[i] != mn) {
      chkmax(len, slen);
      slen = 0;
    } else
      slen++;
  }
  while (lstlen < n && str[n - lstlen] == mn) ++lstlen;
  if (slen << k - 1 >= n) {
    for (int i = (1), _end_ = (n); i <= _end_; i++) putchar(mn);
    exit(0);
  }
  if (lstlen << k >= n) {
    for (int i = (1), _end_ = (n); i <= _end_; i++) putchar(mn);
    exit(0);
  }
  string s;
  slen = 0;
  for (int i = (1), _end_ = (n); i <= _end_; i++) {
    if (i == n || str[i] != mn) {
      if (slen == len) {
        string up = solve(i - len, i - 1);
        if (s.empty() || s > up) s = up;
      }
      slen = 0;
    } else
      slen++;
  }
  if (lstlen > 0) {
    string up = solve1(n - lstlen + 1, n);
    if (s.empty() || s > up) s = up;
  }
  cout << s << endl;
}
inline void doing() {}
int main() {
  init();
  doing();
  return 0;
}
