#include <bits/stdc++.h>
using namespace std;
long long n, m, c;
char s[100005];
int main() {
  scanf("%I64d%I64d %s", &n, &m, s);
  int k, i, j;
  k = 1;
  c = 0;
  for (i = 1; i < n; i++) k += s[i] != s[i - 1];
  for (i = 0; i + 1 < n;)
    if (s[i] != s[i + 1]) {
      for (j = i + 2; j < n && s[j] == s[j - 2]; j++)
        ;
      j--;
      c += 1ll * (j - i) * (j - i + 1) / 2;
      i = j;
    } else
      i++;
  printf("%I64d\n", k * (m * n - n) - c);
  return 0;
}
