#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int n, m;
char a[MAXN];
int main() {
  scanf("%d%d%s", &n, &m, a);
  long long ans = 0;
  char last = 'z' + 1;
  for (int i = 0; i < n; ++i) {
    if (a[i] != last) {
      ans += (long long)n * m - n;
    }
    last = a[i];
  }
  int sub_length = 1;
  for (int i = 1; i < n + 1; ++i) {
    if (sub_length == 1) {
      sub_length += a[i] != a[i - 1];
    } else {
      if (a[i] == a[i - 2]) {
        ++sub_length;
      } else {
        ans -= (long long)sub_length * (sub_length - 1) / 2;
        sub_length = a[i] == a[i - 1] ? 1 : 2;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
