题目传送门
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define P pair<int,int>
const int N=1e6+10;
const int mod=19930726;
void read(int &a)
{
a=0;
int d=1;
char ch;
while(ch=getchar(),ch>'9'||ch<'0')
if(ch=='-')
d=-1;
a=ch-'0';
while(ch=getchar(),ch>='0'&&ch<='9')
a=a*10+ch-'0';
a*=d;
}
void write(int x)
{
if(x<0)
putchar(45),x=-x;
if(x>9)
write(x/10);
putchar(x%10+'0');
}
ll quickmod(ll x,ll y)
{
ll res=1;
ll base=x;
while(y)
{
if(y&1)
res=res*base%mod;
base=base*base%mod;
y>>=1;
}
return res;
}
ll p[3*N],tot[3*N],mid,maxn,n,k;///p[i]算的是i这个位置的字符串的回文半径
string ss,t;
void manacher()
{
t="@#";///在0的位置+一个不相干的字符
for(re int i=0;i<n;i++)///在ss字符串里面插#
{
t.pb(ss[i]);
t.pb('#');
}
for(re int i=1;i<t.size();i++)
{
p[i]=maxn>i?min(p[2*mid-i],maxn-i):1;///如果最右区间比i小,只要维护自己(就是1);反之,p[i]为 i与mid对称点的p值和最右区间-i的较小值。
while(t[i+p[i]]==t[i-p[i]])///在这个p[i]的基础上向左右扩展。
p[i]++;
if(maxn<i+p[i])
maxn=i+p[i],mid=i;///mid记录以哪个字符对称,maxn记录当前最右边的字符位置
}
}
int main()
{
scanf("%lld %lld",&n,&k);
cin>>ss;
manacher();
for(re ll i=2;i<t.size();i+=2)
tot[p[i]-1]++;///p[i]是代表加上了#的回文半径,那么这个半径肯定是偶数的,所以要减1代表这段东西实际的回文长度。
if(n&1)///因为只找奇数的回文串,那么我就分类只做奇数的统计就行了。
for(re int i=n;i>=1;i-=2)
tot[i]+=tot[i+2];///长的串肯定包含一个下一级的串,所以要做后缀和。
else
for(re int i=n-1;i>=1;i-=2)
tot[i]+=tot[i+2];
ll ans=1;
for(re int i=n;i>=1;i--)
{
if(!tot[i])
continue;
if(k>=tot[i])///一个一个乘会超时,所以快速幂走一波
{
ans=ans*quickmod(i,tot[i])%mod;
k-=tot[i];
}
else
{
ans=ans*quickmod(i,k)%mod;
break;
}
}
cout<<ans<<endl;
return 0;
}