#include <bits/stdc++.h>
using namespace std;
const int A = 26;
struct SA {
  vector<unordered_map<char, int> > eg;
  vector<int> len, link;
  int los, sz;
  void add(char ch) {
    int r = len.size();
    sz++;
    len.push_back(sz);
    link.push_back(0);
    eg.emplace_back();
    int p = los;
    while (p >= 0 && !eg[p].count(ch)) {
      eg[p][ch] = r;
      p = link[p];
    }
    if (p >= 0) {
      int q = eg[p][ch];
      if (len[p] + 1 == len[q]) {
        link[r] = q;
      } else {
        int nq = len.size();
        len.push_back(len[p] + 1);
        link.push_back(link[q]);
        eg.push_back(eg[q]);
        link[r] = link[q] = nq;
        while (p >= 0 && eg[p][ch] == q) {
          eg[p][ch] = nq;
          p = link[p];
        }
      }
    }
    los = r;
  }
  void add(const string& s) {
    for (int i = 0; i < s.size(); i++) {
      add(s[i]);
    }
  }
  SA(const string& s) {
    len.push_back(0);
    link.push_back(-1);
    eg.emplace_back();
    los = sz = 0;
    add(s);
  }
};
void bup(int u, int len, string& res, SA& sa) {
  if (len == 0) {
    return;
  }
  for (int i = 0; i < A; i++) {
    char ch = 'a' + i;
    if (sa.eg[u].count(ch)) {
      int v = sa.eg[u][ch];
      if (sa.sz - sa.len[v] >= len) {
        res.push_back(ch);
        bup(v, len - 1, res, sa);
        return;
      }
    }
  }
}
int main() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string rs = s;
  reverse(rs.begin(), rs.end());
  SA sa(s + rs);
  string ru;
  bup(0, n, ru, sa);
  long long nc = 0;
  for (; nc < n && ru[nc] == ru[0]; nc++)
    ;
  int we = nc;
  while (nc < n && k > 1) {
    nc <<= 1;
    k--;
  }
  string res;
  for (int i = 0; i < min(nc, n); i++) {
    res.push_back(ru[0]);
  }
  for (int i = we; i < n; i++) {
    res.push_back(ru[i]);
  }
  res = res.substr(0, n);
  cout << res << '\n';
}
