#include <bits/stdc++.h>
using namespace std;
const int MX = 200005;
int main() {
  string D;
  int N, M;
  scanf("%d%d", &N, &M);
  cin >> D;
  long long ans = N * (M - 1);
  for (int i = 0; i + 1 < D.size(); i++) {
    if (D[i] != D[i + 1]) ans += N * (M - 1) - 1;
  }
  long long cnt = 1;
  if (D[0] != D[1])
    cnt = 1;
  else
    cnt = 0;
  for (int i = 2; i < D.size(); i++) {
    if (D[i] == D[i - 1]) {
      ans -= (cnt - 1) * cnt / 2;
      cnt = 0;
    } else if (cnt == 0)
      cnt++;
    else if (D[i] == D[i - 2])
      cnt++;
    else
      ans -= (cnt - 1) * (cnt) / 2, cnt = 1;
  }
  ans -= (cnt - 1) * (cnt) / 2, cnt = 1;
  printf("%lld", ans);
  return 0;
}
