#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
long long MOD = 1e9 + 7;
int main() {
  long long n = in();
  long long k = in();
  string s;
  cin >> s;
  char c = '{';
  for (long long i = 0; i < s.size(); i++) {
    c = min(c, s[i]);
  }
  long long t = 1;
  for (long long i = 0; i < k - 1; i++) {
    t *= 2;
    if (t >= n) {
      for (long long j = 0; j < n; j++) cout << c;
      return 0;
    }
  }
  string ss = s;
  reverse(s.begin(), s.end());
  string u = ss + s;
  string MIN = "{";
  if (k != 1) reverse(u.begin(), u.end());
  for (long long j = 0; j < n + 1; j++) {
    string tmp = u.substr(j, n);
    MIN = min(MIN, tmp);
  }
  if (k == 1) {
    cout << MIN;
    return 0;
  }
  long long z = 0;
  for (auto e : MIN) {
    if (e == c)
      z++;
    else
      break;
  }
  for (long long i = 0; i < k - 2; i++) {
    z *= 2;
  }
  for (long long i = 0; i < (long long)min(z, n); i++) cout << c;
  for (long long i = 0; i < n - z; i++) cout << MIN[i];
}
