#include <bits/stdc++.h> using namespace std; const int N=1e3+5,MOD=1e9+7; int n,k,ans; int f[N][N]; bool vis[27]; char str[N]; int main(){ scanf("%d%d",&n,&k); scanf("%s",str+1); for (register int i=1; i<=n; ++i) { f[i][1]=1; for (register int j=1; j<=k; ++j) { memset(vis,false,sizeof(vis)); int now=i-1; while (now) { if (!vis[str[now]-'a'+1]) f[i][j]=(f[i][j]+f[now][j-1])%MOD,vis[str[now]-'a'+1]=true; now--; } } } memset(vis,false,sizeof(vis)); for (register int i=n; i>=1; --i) if (!vis[str[i]-'a'+1]) vis[str[i]-'a'+1]=true,ans=(ans+f[i][k])%MOD; if (k==0) ans=1; printf("%d\n",ans); return 0; }