#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 107;
int n, m;
char s[N];
int main() {
  long long ans = 0;
  scanf("%d %d", &n, &m);
  scanf("%s", s + 1);
  m--;
  ans += n * m;
  long long p = 0;
  for (int i = 2; i <= n; i++) {
    if (s[i] != s[i - 1]) p++;
    ans += p * m;
  }
  p = 0;
  for (int i = n - 1; i >= 1; i--) {
    if (s[i] != s[i + 1]) p++;
    ans += p * m;
  }
  int r = 1;
  for (int l = 1; l < n; l++) {
    if (s[l] == s[l + 1]) continue;
    r = max(r, l + 2);
    while (r <= n && s[r] == s[r - 2]) r++;
    ans -= r - l - 1;
  }
  printf("%I64d\n", ans);
}
