#include <bits/stdc++.h>
using namespace std;
int n;
int k;
string s;
pair<int, int> p[10001];
string get_min(string a, string b) {
  if (a == "") return b;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] < b[i]) return a;
    if (a[i] > b[i]) return b;
  }
  return a;
}
int main(void) {
  scanf("%d%d", &n, &k);
  cin >> s;
  string ns = "";
  ns = s;
  reverse(ns.begin(), ns.end());
  s += ns;
  int mn = (s[0] - 'a'), cnt = 1, now = 1;
  for (int i = 1; i < s.size(); i++) {
    if ((s[i] - 'a') < mn) {
      mn = (s[i] - 'a');
      now = 0;
    }
    if ((s[i] - 'a') == mn) {
      now++;
    }
    if ((s[i] - 'a') > mn) {
      now = 0;
    }
    cnt = max(cnt, now);
    p[i] = pair<int, int>((s[i] - 'a'), now);
  }
  int cnt_k1 = cnt;
  for (int i = 1; i < k; i++) {
    if (cnt >= n) break;
    cnt *= 2;
  }
  if (cnt >= n) {
    string ans = "";
    for (int i = 0; i < n; i++) {
      ans += ('a' + mn);
    }
    cout << ans << endl;
  }
  string ans = "";
  for (int i = n - 1; i < n * 2; i++) {
    if (p[i] != pair<int, int>(mn, cnt_k1)) continue;
    string tmp = "";
    for (int j = 0; j < cnt; j++) {
      tmp += s[i];
    }
    int pos = i - cnt_k1;
    while (tmp.size() < n) {
      tmp += s[pos];
      pos--;
    }
    ans = get_min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}
