#include <bits/stdc++.h>
using namespace std;
char s[100005];
long long f[100005][8];
int n, m, a[100005];
const int mod = 99244353;
inline int qr() {
  char a = 0;
  int w = 1, x = 0;
  while (a < '0' || a > '9') {
    if (a == '-') w = -1;
    a = getchar();
  }
  while (a <= '9' && a >= '0') {
    x = (x << 3) + (x << 1) + (a ^ 48);
    a = getchar();
  }
  return x * w;
}
inline int neg(int a) { return (a % mod + mod) % mod; }
inline int mul(int a, int b) { return 1ll * a * b % mod; }
inline int sub(int a, int b) { return a - b < 0 ? a - b + mod : a - b; }
inline int add(int a, int b) { return a + b > mod ? a + b - mod : a + b; }
int main() {
  n = qr(), m = qr();
  scanf("%s", s + 1);
  for (register int i = 1; i <= n; i++) a[i] = s[i] - 'a' + 1;
  f[0][7] = 1;
  for (register int i = 0; i <= n - 1; i++)
    for (register int j = 0; j < 8; j++) {
      if (!f[i][j]) continue;
      for (register int k = 1; k <= m; k++) {
        int nxt = 0;
        if (k == a[i])
          nxt |= j & 1;
        else
          nxt |= (j >> 1) & 1;
        if (k == a[i + 1])
          nxt |= ((j >> 1) & 1) << 1;
        else if (!(((j >> 2) | nxt) & 1))
          continue;
        if (k == a[i + 2])
          nxt |= ((j >> 2) & 1) << 2;
        else
          nxt |= ((nxt >> 1) & 1) << 2;
        f[i + 1][nxt] += f[i][j];
      }
    }
  printf("%lld\n", f[n][0] + f[n][1]);
  return 0;
}
