#include <bits/stdc++.h>   using namespace std;   vector<int> prefix_function(string s) {     int n = (int)s.length();     vector<int> pi(n);     for (int i = 1; i < n; ++i) {       int j = pi[i - 1];       while (j > 0 && s[i] != s[j]) j = pi[j - 1];       if (s[i] == s[j]) ++j;       pi[i] = j;     }     return pi;   }   int main() {     int t, n, x = 0;     cin >> t >> n;     string s;     cin >> s;     cout << s;     vector<int> v = prefix_function(s);     s = s.substr(v[v.size() - 1], s.size() - v[v.size() - 1]);     for (int i = 1; i < n; i++) {       cout << s;     }   }   