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