#include <bits/stdc++.h>
using namespace std;
char s[100100];
long long get(int k) { return 1LL * k * (k - 1) / 2; }
int main() {
  int n, m;
  scanf("%d%d%s", &n, &m, s);
  long long res = 1;
  for (int i = (0); i <= (int(n - 1) - 1); ++i)
    if (s[i] != s[i + 1]) res++;
  res *= n * (m - 1);
  s[n] = '.';
  s[n + 1] = '.';
  int last = 0;
  for (int i = (0); i <= (int(n - 1) - 1); ++i) {
    if (s[i] == s[i + 2]) {
    } else {
      if (s[i] != s[i + 1]) res -= get(i - last + 2);
      last = i + 1;
    }
  }
  cout << res << endl;
  return 0;
}
