#include #include #include using namespace std; typedef long long LL; const int kMod = 19930726; const int kMaxN = 1e6 + 10; int n; LL K; char s[kMaxN]; int d1[kMaxN]; LL cnt[kMaxN]; LL qpow(int a, int b) { LL res = 1; while (b > 0) { if (b & 1) res = (res * a) % kMod; b >>= 1; a = (a * (LL)a) % kMod; } return res; } int main() { #ifdef local freopen("pro.in", "r", stdin); #endif scanf("%d%lld", &n, &K); scanf("%s", s); for (int i = 0, l = 0, r = -1; i < n; i++) { int k = (i > r) ? 1 : min(d1[l + r - i], r - i + 1); while (0 <= i - k && i + k < n && s[i - k] == s[i + k]) { k++; } d1[i] = k--; if (i + k > r) { l = i - k; r = i + k; } } LL tot = 0; for (int i = 0; i < n; i++) { tot += d1[i]; cnt[d1[i]]++; } if (tot < K) { printf("-1\n"); return 0; } for(int i=n-1;i>=1;i--) cnt[i]+=cnt[i+1]; LL lft = K, res = 1; for (int i = n; i >= 1; i--) { if (cnt[i] > 0) { if (cnt[i] < lft) { res = (res * qpow(2 * i - 1, cnt[i])) % kMod; lft -= cnt[i]; } else { res = (res * qpow(2 * i - 1, lft)) % kMod; break; } } } printf("%lld\n", res); return 0; }